There a couple of funny books that do this by an author called Yvonne Morrison, Little Red Riding Hood ( Not Quite) and The Three Bears ( Sort Of) where a kid asks questions about everything, particularly point out the illogicality of these fairy tales.
I don't think it even has to b anything so deliberate. But the stories have to be good, and substantial.
I remember reading a story book as a little girl, The Story About Ping. It was about a duck who doesn't want to be spanked by the duck-keeper, so he runs off from the boat where he lives with his family. He goes out on the river and sees a few disturbing things and finally is almost eaten. He finds the boat at the end and goes back, puts up with being spanked for being late, and stays safe and warm with his family.
It was a compelling story, well written, and it raised so many questions. Was it unjust to spank the ducks or did it keep them safe? Was Ping better off taking his chances free on the river, or safe with his family in captivity?
The story gave no real direction about these kinds of questions, I had to think about them and come to my own conclusions. I don't think it would be read to school children today, or given to them by most parents, because the messaging would be seen as wrong or unclear. And too serious and scary. Books without clear answers upset the parents.