This fixes an edge case (introduced by #6654 and reported by @sipa here: #6654 (comment)) in removing an entry from the mempool during the middle of a reorg, where the entry has an in-block ancestor which has not yet had its descendant state updated for the transaction being removed.
The first commit updates the mempool_packages.py rpc-test to include a test that demonstrates the bug; the second commit provides a fix.