Looks like we are currently accessing mapWallet without a lock held in CWallet::SyncTransaction(..). I tested this with AssertLockHeld(cs_wallet) and indeed, no lock.
- moved the lock from AddToWalletIfInvolvingMe(..) to SyncTransaction(..)
- using return value of AddToWalletIfInvolvingMe(..) to determine whether the tx is in the wallet