The OP_HASH256 puzzle transaction described here was mined in block 211997. But I read that only standard transactions (with outputs one of P2PK, P2PKH, bare multisig, P2SH, OP_RETURN) get relayed. So how did this transaction get relayed and mined?
"Relayed" and "mined" are completely separate processes and should not be conflated.
The transaction is valid, so it was perfectly fine to mine it (i.e. include it in a valid block).
"Standard" is a more restrictive requirement, and as you say, this transaction is not standard. That means that a default version of Bitcoin Core will not relay it, i.e. will not transmit it to other nodes on the Bitcoin peer-to-peer network. But if the transaction reaches a miner some other way, they are perfectly free to include it in a block.
We can only speculate as to how that occurred in this case, but here are some possibilities:
Some people were running a modified version of the Bitcoin client (or alternative Bitcoin software) that does relay non-standard transactions.
The creator of the transaction sent it directly to a miner, by some means other than the peer-to-peer network. Some miners or pools have web sites where anyone can submit a transaction.
The transaction was created by the miner herself.