I am studying horizontal transmission of primary symbionts in insect reproduction. This reminded me of an earlier question I had asked, in which I learned that humans analogously acquired their particular microbiomes. It is also known how the human gut can be stratified in microbial content along the digestive tract. My question is what mechanisms are employed in ensuring that organisms acquiring their microbiomes from outside sources via horizontal transmission acquire the correct microorganisms in the correct parts of the gut? As the human gut metagenome does show "homology" between individuals, it can be safely assumed that the process can't be due to random chance.
tl;dr it really might be due mostly to random chance, in terms of intentional mechanisms at least.
One thing that is important to remember about the gut tube is that conditions of life for microflora vary dramatically from one end to the other. This is true of nutrient availability, pH, and antimicrobial load. For example, the bacterial load of the lower intestinal tract is approximately seven orders of magnitude higher than the upper GI tract (stomach). They're just completely different places.
In some cases you can try to impute the bacterial assemblage in some part of the gut to a specific biological cause furnished by the host, for example the role of bile salts in controlling which organisms are able to colonize certain locations.
But a more parsimonious explanation is that the bacteria are growing in the places where they are good at growing. This brings up the old ecological saying: "Everything is everywhere, but the environment selects." We aren't necessarily trying explicitly to reinforce a certain assemblage, that's just the assemblage that works in niches with very low pH, very high nutrient load, bile salts, etc. And most of those features are unavoidable consequences of the gut's main function, digestion/excretion.
It certainly doesn't seem that e.g. behavioral strategies for exposing yourself to the "right" microbes gets you the right microbes in the right places. Recall that fecal microbiome transplant is one of the most successful strategies- just take some healthy poop and put it into a sick person's GI tract, they get better! That's not a very controlled horizontal transmission strategy.
You could propose that there is some second-order selection going on in which we have constructed GI niches in such a way that they encourage certain assemblages. Certainly, dysbiosis occurs and is bad in such cases as e.g. C. difficile infection, we would like to avoid those. Probably some coevolution has occurred between host and microbe, for example immune responses and butyrate production. That Foster paper has some more examples of possible mechanisms for a couple of specific cases, for example mucus. But they are probably not sufficient to explain the full compartmentalization of the microbiome in the way that you seem to be asking.