This is a dangerous (and common) misconception about the immune system.
Most of your immune system training occurs in the stomach where, predictably, an absolutely enormous amount of foreign matter enters your body. This is standard medical teaching.
It's a misconception that the immune system builds future resistance from past infections?