I wonder of the original was partially a cautionary tale for girls to be careful where they fall asleep lest they end up in a bad situation?
I think of stories about trolls under bridges eating children as cautionary tales against people living by the river – which is usually good advice for kids.