The logic appears to be that our immune systems are simply built to be under far more stress than they currently are. We are not evolved to exist in hygienic environments we have today.
As a result, our immune system a huge behemoth evolved to fight a massive and continuous war of attrition, yet the hostiles arrive in far smaller numbers than what it is designed for, often hopelessly outnumbered and weakened. A a result, it begins to seek enemies to fight, reacting to smallest abnormalities
.
Which is what allergy is. Hence, allergies make perfect sense. They are a clear sign of immune systems far too powerful for hygienic environments we live in, an excellent showcase of cultural evolution far outstripping biological evolution in speed.