Fixes #35626.
<details> <summary>Legacy wallets can contain transactions they don't own, due to BDB log file cross-contamination.</summary>
This happened when users swapped wallet.dat files manually (stopping the node and renaming files) without first flushing the BDB log files. BDB writes data to log files before checkpointing them into wallet.dat; if only the .dat was swapped but the log files remained, a subsequent node start replayed those logs into the new wallet, writing in transactions from a completely different wallet. The affected wallet has no keys or scripts for those transactions — gettransaction shows an empty details array.
</details>
Before this fix, migratewallet aborted with a fatal error when it encountered such a transaction in mapWallet that belonged to no migrated wallet:
Error: Transaction <txid> in wallet cannot be identified to belong to migrated wallets
<details> <summary>This change downgrades the fatal error to a warning and removes the unidentified transaction from the migrated wallet instead of aborting (as <a href="https://github.com/bitcoin/bitcoin/issues/35626#issuecomment-4846118013">suggested</a> by achow101).</summary>
The txid is logged so the user can inspect it. The existing txids_to_delete / RemoveTxs mechanism (already used for watchonly transactions) handles the removal.
</details>
This fix applies to both the migratewallet RPC and the equivalent GUI option, as both go through the same migration code path.
<details> <summary>A test is added to <code>wallet_migration.py</code> that simulates the cross-contamination scenario...</summary>
a watchonly address is imported so the wallet records a foreign transaction, then the watchonly script and address book BDB records are erased, leaving a transaction in mapWallet with no wallet claiming it.
</details>