While it's not same with what you mentioned, it's possible if you use OP_RETURN function.
You need use BIP38 to encrypt your private and add your encrypted private key to a transaction with OP_RETURN, even though OP_RETURN function isn't supposed to store any data besides transaction/P2SH for features such as multi-sig. Also, it's risky to expose your encrypted private key, even if you encrypt it with strong passphrase. You also need to remember the transaction ID and the process isn't user friendly.