This is a backport of core#19077
Note that none of these changes was actually necessary to make this test pass with `--descriptors`, but my main goal with this backport is to make subsequent backports easier, so pick as many changes as possible.
The change to BitcoinTestFramework.default_wallet_name and the "Unable to obtain an exclusive lock" error message are not applicable due to missing sqlite related backports.