Is it possible to prove the time a message was produced? Say Bob wants to tell Alice a secret message, then they start some message exchanges protocol. At the end, Alice will receive the secret message and can be convinced that the message was not produced earlier (and obviously not later) than the time they communicated.

An attacker (Bob included) will try to win by forging the secret message before they start the message exchanges.

As for a real world scenario, consider the secret message a picture, showing something of Alice's interest. Bob sends this picture to Alice, Alice however, doubt the picture was taken a long time ago, so she challenges Bob to send as well some random angles of the things showing in the picture as she requested until she is convinced that the things showing in the picture are there at the time they communicate. Note that the things in the picture can be there a long time ago (e.g. an old house) , but the secret message (the picture showing the old house) was only produced at that moment.

The security of the above scenario is only based on Bob not knowing the random choice of the angles Alice will pick and the infeasibility of Bob quickly creating a fake picture at the said angle. Can cryptography provide something better than these?

Somehow I believe the "infeasibility to create variants of the secret message" is a must assumption to guarantee the proofs. So may be in real world this cannot be a simple plaintext message, but sound, picture, video, 3D model, etc., which are difficult to edit?
If the the message is generate by a one-way function then incorporating in the message a sample from a randomness beacon (such as https://www.nist.gov/programs-projects/nist-randomness-beacon) will prove that the message was generated at a time later than when the sample was taken.