[backport#17304 17/18] Refactor: Move GetKeypoolSize code out of CWallet
Summary:
This commit does not change behavior.
https://github.com/bitcoin/bitcoin/pull/17304/commits/7ef47b88e67718766c92d23973742d08436176e0
Depends on D7163
Partial backport of Core PR17304
Test Plan:
ninja check
Reviewers: #bitcoin_abc, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Differential Revision: https://reviews.bitcoinabc.org/D7164