Comment by theptip
The problem with Evolutionary Psychology is that it’s easy to construct this sort of “just so” story for pretty much any causal link, and they are not falsifiable.
IMO the simpler hypothesis here is that this isn’t anything adaptive, it’s just another example of how biology is like spaghetti code; changing one chemical signal will affect an essentially random set of downstream systems, some of which can be causally connected to psychology/behavior.
Could also be like climate change, where it correctly describes a broad phenomenon, but cannot be used to identify or classify any individual event. E.g., Wildfires are probably getting worse because of climate change, but it's difficult to say if the Pacific Palisades fire would not have happened in a cooler global climate.
So, is microbiome-mediated social anxiety selected for as an advantageous trait for societies subject to communicable diseases and the travails of nomadism? Maybe. Did YOUR microbiome-mediated social anxiety arise because it was advantageous for your community? Probably impossible to say.
Also, a hole in GP's logic: you would expect protective social anxiety to arise in people whose situation hasn't much changed except that they've encountered people whose has (as with sedentary villagers encountering nomads who may or may not be about to ransack their settlement).