This is another step to transit CTxMemPool::cs from RecursiveMutex to Mutex.
Split out from #19306. Only trivial thread safety annotations and lock assertions added. No new locks. No behavior change.
Refactoring const uint256 to const uint256& was requested by promag.
Please note that now, since #19668 has been merged, it is safe to apply AssertLockHeld() macros as they do not swallow compile time Thread Safety Analysis warnings.