[refactor] versionbits: make VersionBitsCache a full class
Summary:
Moves the VersionBits* functions to be methods of the cache class,
and makes the cache and its lock private to the class.
This is a partial backport of core#19438
https://github.com/bitcoin/bitcoin/pull/19438/commits/0cfd6c6a8f929d5567ac41f95c21548f115efee5
Depends on D12224
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D12225