In "The Prisoner", an episode of 'The Adventures Of Robin Hood', the song "All Around My Hat" is used as a coded acknowledgement that the singer is an ally to King Richard the Lion-Hearted.
I've embedded the video here. You only have to watch the first scene to get a taste of the song, but watch it through for a great guest appearance by Donald Pleasance.....
This episode took place in the 1190's; however, there is no historical record of the song before 1888 in the Trueniverse.
The same thing happened with another song, "The Sloop John B". Dr. Miguelito Loveless and his lovely companion Antoinette sang this song to their prisoners James West and Princess Wanakee in "The Night Of The Raven", probably the most science-fiction oriented episodes of 'The Wild Wild West'.
The episode took place in the 1870's for Toobworld, but it was based on something that happened around 1900. And the song was officially transcribed until the 1930's.
I'm not going to go into pretzel logic splainins involving wormholes and other wibbly wobby timey wimey stuff with this one. I'll invoke Occam's Razor and go with the easiest splainin - as far as Toobworld goes, both songs were long in existence before they ever appeared in the Trueniverse.