This is both good practice (we want to move all such callbacks
into a background thread eventually) and prevents a lock inversion
when we go to use this in wallet (mempool.cs->cs_wallet and
cs_wallet->mempool.cs would otherwise both be used).
This is extracted from Core's PR10286 commit 3ea8b75281edc60078423bd5d277cd2a84aa5d33
Depends on D2263