I'm lucky and I'm allergic to nothing. Though at one time I was allergic to Maple pollen.
I heard allergies are caused when the immune system does not have anything to fight off so it creates a problem so it can fight it. It makes sense.
So I guess those who have allergies are well protected from bacteria and those who don't are not well protected. I wouldn't make that theory a fact though. I would assume that there might be some allergies obtained through genetics and possibly just spontaneously for some cases.