IIRC, many of the most popular fairy tales give happy endings by pure luck and happenstance. Catch a fish with a magic ring, etc…. The ones with moral lessons are too on-the-nose to be enjoyable.
These used to be more than just stories for kids, but modern fairy tales are rarely ever told to an adult audience anymore. For many fairy tales, the happy ending was added centuries after they spread.
https://en.wikipedia.org/wiki/Binding_of_Isaac#Possible_chil...