Why, you probably aren't but I will pretend you are wondering, would friends and strangers subject a child who might well be ugly but still not deserving of such treatment to such treatment?
Because complimenting a child, according to my specialist-level understanding of olden days Egyptian culture, would draw the malevolent eyes of some malevolent gods upon him or her. Someone who is high will be brought low; someone who is already low can only go up (and then down again, inevitably).
This haunting, yet exhaustively informative tale should inform your future, catastrophytes. If you are feeling peppy, immediate cleanse the palate with some wrenching fear, because clearly that enthusiasm will only bring disaster upon you. You do not have to believe in malevolent gods, only the general malevolence of life.
But remember, though, that avoiding a sense of well-being will not help you, either. As life's malevolence is general and disinterested (so it's not really malevolence, per se, but I enjoy the meatiness of that word and so will use it despite its total inappropriateness), you can be struck by almost laughably unfortunate misfortune when you've already been punched in the neck by life.
So did their rhetorical cunning help the Egyptians, or more to the point, their babies? Probably not. Because as I've already said, life can smite you terribly at random times, and not just when you're lookin' good.