This requires slightly reorganizing the logic in GETBLOCKTXN to
maintain locking order.
This is a backport of core#19911 [5/6]
https://github.com/bitcoin/bitcoin/pull/19911/commits/ba951812ec0cc8ebee5911a582f188525b76ff0a
see D10187 for the removal of the !cs_main negative lock
Depends on D10529