Don't anthropomorphize evolution; it has no intent, and does not actively "select" beneficial traits. Over time, whatever traits happened to propagate will propagate. Some of those will be beneficial; others just didn't happen to kill people.
Notice that there's no widespread anaphylactic-level allergy to, for instance, water, or some standard component of atmosphere. But an allergy to peanuts does not systematically kill everyone who has it before they can reproduce.
And thanks to the evolution, if not for science, the defect might be eliminated in a few generations. Or not - perhaps this is an optimal variant of immune the immune system. That is - 90% of organisms will have an excellent immunity, but it will go haywire in 10% of cases, whereas an alternative would be a system with 99% organisms having just an average immune system, but 1% being haywired.
Finally, evolution has no "target" or "goal" really. Some features will be broken, and some will be useless. Some may serve a purpose that's beyond our understanding or extremely complex.
Because our bodies are the product of selection over random variation, not perfectly crafted designs for survival. So we end up with systems that, while some are surprisingly simple and elegant, are often complex, convoluted, and despite working well and correctly most of the time in normal cases (and even often in many extreme ones) still can have very bad failure modes.
Your body has an extremely complicated and mostly successful system of defence. If a pathogen enters the body and is not attacked, it may easily kill you, for this reason pathogens, once identified, are always attacked. There is a system that is responsible for identifying threats(lymphocyte), some times this messes up and identifies the wrong thing as a threat. This is easier than you might think because your body makes antibodies(attack living stuff like bacteria but quasi stuff like viruses) and antitoxins(attacks toxins), when the body sees a foreign substance in the blood, it only takes one lymphocyte is misread it as a threat, and boom all-of-sudden your body fights like the devil to kill/remove/subdue that thing.
Backing down the response would alleviate some allergy problems, but it would also cause the body to perhaps miss some actually-bad things in your system. It'll be hard to change this, and problem inadvisable, as the system has been tuned over millions of years. The best course of action is probably treating symptoms, or finding targeted and intelligent ways to trick the system into handling these corner cases better.
While I am no pathogen expert, I can't imagine many things (if anything) more dire to the human body then oxygen deprivation. To the extent that if you're intentionally holding your breath, you'll pass out and your body will involuntarily start breathing again to keep you alive.
That said, maybe the body does view internal (pathogen/poisons) attacks more critical to preserving life then oxygen. Anyone know?
Not at all. The individuals (and the genes) don't need to have any goals or any notion of autonomy. It could just be that genes come about randomly, and the ones that are most successful at existing in the future will be the ones that cause a small portion of individuals to die when doing so increases the odds of survival of the rest of the individuals.
"Your body" doesn't have anything like the ability to analyze good or bad. Some mysterious emergent phenomena in your brain does, but the overall mechanisms we reused from other species don't.