This removes the last use of CWallet::GetDBHandle, which is a layer violation (breaking encapsulation of CWallet::database) whose own comments call for its removal.
After this, the only remaining external users of database is LegacyScriptPubKeyMan via CWallet::GetDatabase, extracted in #17260.