cli: lift -rpcwallet logic up to CommandLineRPC()
Summary:
to allow passing rpcwallet independently from the -rpcwallet user option, and to
move the logic to the top-level layer where most of the other option args are
handled.
This is a backport of Core PR18594 [2/6]
https://github.com/bitcoin/bitcoin/pull/18594/commits/743077544b5420246ef29e0b708c90e3a8dfeeb6
Depends on D9237
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9238