This is inspired by core#32827 and D13214:
orphanage: avoid vtx iteration when no orphans
We can avoid a costly iteration over all transaction inputs in a block if we already know that we don't have any txs to erase in our pool.
The subsequent call to TxPool::EraseTxNoLock would also be a no-op with an early return (if (m_pool_txs.find(txid) == m_pool_txs.end()) return 0;)