Add wallet logic for dealing with multiple ScriptPubKeyMan instances. This
doesn't change current behavior because there is still only a single
LegacyScriptPubKeyMan. But in the future the new logic will be used to support
descriptor wallets.
https://github.com/bitcoin/bitcoin/pull/17261/commits/c729afd0a3b74a3943e4c359270beaf3e6ff8a7b
Note: Had to bring in PR18052 to fix an instance of -Wmaybe-uninitialized
Depends on D7858