Verifying that a transaction is in the blockchain
Just to be clear: It's not the entire block that is being hashed, as you said, blocks are found by hashing only the block header of a candidate block. However, the block header includes the Merkle root of the transaction tree which in turn commits to the exact set of transactions in the block.

You're correct, a cryptographic hash function is a one-way function and the block content is not retrievable from the hash. To learn the content of the block, you use the block hash as a unique identifier and request the complete block from an archival node, i.e a full node that keeps the complete Bitcoin blockchain in store.

In turn, if you only have the txid to go from, you can request the full transaction from any node that has knowledge of it. The raw transaction does not include the information in which block it was included though. AFAIU, to get that you'd do a getData request of the MSG_MERKLEBLOCK type. This will not only give you the full transaction, but also hashing partners to form the Merkle branch up to the block hash and the block header, allowing you to fully validate the transaction's inclusion in the blockchain.