Perhaps fairytales are also a way of putting the world to rights as most of them do show justice being done to those who are cruel. They also show redemption and a happy ending happening to the virtuous and, well frankly, how often does that happen in life? They can also be a kind of wish fulfilment (some pun intended) given the idea of a fairy godmother turning up to put matters right would appeal to anyone feeling remotely downtrodden.
And, of course, fairytales are a great way of introducing the love of stories and books to children in the hope they will go on to develop good reading habits. I have fond memories of my first fairytales and the wonderful illustrations that went with them. (I still have those Reader's Digest Complete Fairytales collections - and they were the original tales by Andersen, Grimm etc. The books are bound up with tape and I couldn't tell you how often I read them).
Ironically not all fairytales are happy, some are pretty violent and what happens to the wolf in The Three Little Pigs (in the original version) is definitely not for the very young, but I know I relished justice being doled out to the wicked. Roald Dahl knew that too. If ever there was an author who knew his audience, he is it!