Comment on a hijack, putting me real far out there …
You shouldn’t be blaming much on the brothers Grimm. Remember that they didn’t write the stories, they collected them. Unless you want to fault them for bringing them to a wider audience, you’ll have to blame the people who thought up the stories (mostly over-protective and perhaps over-imaginative mothers).
That is if they even are to blame for this. I’d say some of this morbid stuff taught to children may not have been intended seriously by parents (despite what the children ended up believing). A lullaby doesn’t need to have meaningful words, so maybe someone came up with the lines as a joke.
As for the child’s prayer, it probably grew out of an earlier time when children may not have lived as long, and memento mori was all the rage. The links mention a likely origin in the 18th century. It was probably something taught before then, and eventually made into print when enough people felt like reminding children that they, too, were mortal.