walletdb: track database file use as m_refcount within BerkeleyDatabase
Summary:
Instead of having BerkeleyEnvironment track the file use count, make
BerkeleyDatabase do it itself.
This is a backport of core#19335 [2/5]
https://github.com/bitcoin/bitcoin/pull/19335/commits/4fe4b3bf1b152877677a6115f82aefaf318dd514
Depends on D10034
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D10035