>Maybe those sick fairy tales were intended as a warning to children.
This is true.
Scary stories are very effective at getting kids to learn a message. Life was also much harsher when many of those stories were written, and parents had to make sure their kids were aware of very real dangers in the world.