Is there any protocol for proving that a message was written at a certain time?
In general, no.

You can prove a message was written no later than time T by hashing the message with a collision-resistant hash, and communicating the hash to some trusted third party that records it was aware of the hash at time T. The bitcoin blockchain can be used as a third party here. You don't need to put the whole message in the blockchain, just a hash.

You cannot prove a general message was written no earlier than time T. If there was an alleged way to prove that, you could just write a message earlier than time T, wait for time T, and perform the alleged proof, tricking any verifier.

If you can communicate back and forth with a verifier, you can prove you are writing the message during the communication, by hashing your message along with some random data provided by the verifier and passing the hash back to the verifier.