This is a current rebased version of #7753 by @laanwj. Please see that PR for original discussion and existing ACKs.
Add notifications when transactions enter or leave the mempool.
These can be enabled with zmqpubmempool:
mempooladded: a transaction was added to the mempool mempoolremoved: a transaction was removed from the mempool
[…]
It also makes it possible to keep statistics on why transactions disappear from the mempool.