There are all sorts of twists and turns to this.
In the GI tract there are typically 300-1000 types of bacteria, of which around 30 occupy almost all the space and prevent blooms of other types. There are also a lot of other microorganisms, and a vast number of viruses, most of which are bacteriophages, because they attack bacteria.
A fetus has a fairly bacteria free GI tract, and they get their first big culture from their mother while being born and through her milk. For about two weeks after birth, they are still using residuals from their mother’s immune system to protect them as well, and this is when they develop their flora.
They keep this collection of microorganisms until they begin solid food, which creates a new intestinal flora very different from their first. This changes once or twice more in adapting to adult food and regional differences.
Importantly for a vast length of time there was another component to this mix: parasites. Our immune system and our flora both adapted to deal with parasites that modern man rarely has.
In turn, this may confuse our immune system which then attacks the body with any number of auto-immune diseases, from asthma to arthritis, Crohn’s disease to IBS.
Some medical researchers are now looking for the chemical signature of parasites, as it could trick a confused immune system like this into returning to normal.