There's a whole raft of pious medieval legends that grew up around the infancy of Christ, since the Bible and for that matter sacred Tradition say next to nothing about it.Sure enough, and many of them are quite beautiful and pious. I can certainly enjoy those for what they are, even though they are merely legends. But how can the ones that portray Christ, the very Son of God, in an irreverent and frankly nasty way be considered "pious"?
Many of the songs "of the people", that is to say folk songs from rural England, point morals that seem a little odd to modern urban/suburban people and as you say even a little nasty. But you have to think about where they're coming from, so to speak.
I think this folk song speaks to the old Anglo-Saxon people who were put down by the Norman aristocracy - to the unlettered rural folk who worked hard for their living and were looked down upon by the gentry - pointing the moral that the gentry and nobility ("we are lord's children, born in the lofty hall, and you are but a poor maid's child, born in an ox's stall") shouldn't be mean to the poor folk because you never know who you might be talking to.
Think of all the Grimm's Fairy Tales in which the kind child who is polite and helpful to the poor beggar-woman or the starving dog who turns out to be a fairy in disguise.
I think it also says something about the proper use of power, and that children haven't the sense to use it wisely.
As I said, you have to take it as it stands. Medieval folk did not put their religion into a box and just take it out on Sunday -- most went to daily Mass and religion was in everything they did. So the simple country folk saw religion as a matter of daily life -- and it is a bit too coarse for our modern sensibilities.