Add util::Ref class as temporary alternative for c++17 std::any
Summary:
This commit does not change behavior
Partial backport of core PR18740:
https://github.com/bitcoin/bitcoin/pull/18740/commits/691c817b340d10e806dc3b1834d2a8fcc5e681fd
Test Plan:
ninja check
Reviewers: #bitcoin_abc, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Differential Revision: https://reviews.bitcoinabc.org/D7989