Extracted from #18453 to preserve that PR as a discussion on multiwallet RPC/CLI.
This PR updates bitcoin-cli -getinfo to fetch the wallet balance from getbalances in order to no longer depend on getwalletinfo.balance which was deprecated a year ago in facfb41.
I found this when removing the getwalletinfo() balance, unconfirmed_balance, and immature_balance fields to see what broke from depending on them.
I didn’t see any perceivable change in -getinfo run time from the change.
Test coverage for this change is provided by test/functional/interface_bitcoin_cli.py, which the second commit updates to (a) no longer depend on getwalletinfo.balances and (b) test the -getinfo blockcount and balance fields against non-default, non-zero values.