Thalaba the Destroyer
This is an epic poem written by Robert Southey published in 1801; the main character is named Thalaba and he is engaged in a war with sorcerers (the Wikipedia article has a detailed plot summary). The story is a mix of Islamic motifs (it even includes the Simurgh!) but it is set in a fantasy version of ancient Babylon. I don't know anything about Robert Southey, so I decided to look him up next.
Southey was a Romantic poet, and Poet Laureate of England from 1813 to 1843. Some people consider the Thalaba poem to be his masterpiece, and he also wrote histories as well as poetry. And imagine my surprise: he was the first person to publish the story of The Three Bears. So of course I have to look that up next!
This story started out as being about three bachelor bears and an old woman who enters their house, but the old woman eventually turned into "Goldilocks" and the bears turned into a Papa Bear, Mama Bear, and Baby Bear. Robert Southey's version, published in 1837, has the three bachelor bears (one big, one small, and one in-between), and the old woman. A version with a little girl appeared in 1849, but "Goldilocks" belongs to the early 20th century.
And from that article, I found out that there is even a Goldilocks Principle: "in a given sample, there may be entities belonging to extremes, but there will always be an entity belonging to the average." So, it's not really about Goldilocks, but about those three bears: two extreme and one in the middle. The article gives examples from economics, psychology, medicine, and even astrobiology: "The Rare Earth Hypothesis uses the Goldilocks principle in the argument that a planet must neither be too far away from, nor too close to a star and galactic center to support life, while either extreme would result in a planet incapable of supporting life." Such a planet is called a Goldilocks Planet... which is where I will end my Wikipedia Trail for today!