rpclib: Unify code for internally generated requests
We now have a single type to represent the error "A request that we made internally didn't get a result we expected." The functions to generate these requests are now centralized too.
Closes #1587 (closed).