Normal gut bacteria also coat the GI tract, preventing pathogenic bacteria from sticking to the surface of the intestines. This is part of the reason babies under 1 should not eat raw honey (which has C. botulinum spores that can stick to the intestines and produce botulinum toxin), while older kids and adults have no trouble with it.
Along the same lines, a hot (though, admittedly disgusting) area of research in medicine now is fecal transplant for people with a particularly aggressive form of colitis. I believe that the research on glut flora transplantation is also being expanded to weight loss, but I'm not very familiar with the studies.
We also know that antibiotics that kill gut flora lead to health/digestion issues until the gut flora is replenished.
It doesn't take nearly as many why questions to get to a "we don't know" answer with biology versus physics. There's lots of stuff about biology we can observe but do not understand the why as well as we understand something like the physics behind a microprocessor.
There are even theories that gut bacteria can drive human behavior at some level. https://www.theatlantic.com/health/archive/2015/06/gut-bacte...