[backport#17593][test] move wallet helper functions into test library
Summary:
https://github.com/bitcoin/bitcoin/pull/17593/commits/78e283e656bf1643944ffdb76185f3468eb25895
Depends on D7284
Concludes backport of Core PR17593
Test Plan:
ninja all check check-functional ./src/bench/bitcoin-bench
Reviewers: #bitcoin_abc, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Differential Revision: https://reviews.bitcoinabc.org/D7285