Partial backport of core#26646:
https://github.com/bitcoin/bitcoin/pull/26646/commits/1605886380e4d3ff2e1236739fb800fa07322c49
This includes some code from https://github.com/bitcoin/bitcoin/pull/24152/commits/51edcffa0e156dba06191a8d5c636ba01fa5b65f
that was skipped during the backport of core#24152 because the test case was segwit related.
Some of the code was later reintroduced to create a non-segwit test for checking tx deduplication, and we need to add back
the relevant skipped changes to check the correct behavior here: if parent2 is not 0-fee, then it's valid according to the
mempool policy and so the package feerate is not computed (all txs being individually compliant, there is no reason to
check the package feerate).
Depends on D16395.