if it happens, the block cannot record "such transaction" because it not in all full node' mempool.
Solo miners and mining pools run nodes.
If
ALL nodes (including the sender, the receiver, and ALL miners) have dropped the transaction from their mempool, then the transaction will never confirm (unless someone rebroadcasts the transaction).
If a solo miner or mining pool keeps the transaction in their mempool, that miner (or pool) can confirm the transaction into a block. The rest of the nodes will receive the transaction when they receive the block.