This is needed for RPCs that need to be called and handled sequentially, rather
than alone or in a batch.For example, when fetching the balances for each loaded wallet, -getinfo will
call RPC listwallets, and then, depending on the result, RPC getbalances.
This is a backport of Core PR18594 [1/6]
https://github.com/bitcoin/bitcoin/pull/18594/commits/29f2cbdeb7afdde87d108adf80cffad17d112632