rpc: move Ensure* helpers to server_util.h
Summary:
This is a partial backport of core#20295
https://github.com/bitcoin/bitcoin/pull/20295/commits/b884ababc29ce963826d8a4327ed6a5e629ff175
Depends on D12700
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D12701