The Hygiene Hypothesis, which is what you have described, fell out of favor in research circles during the late 2000s. What seems to be causing the allergy and autoimmunity epidemic is a loss of keystone species in the gut that have co-evolved with humans and provided essential services to the immune system, as well as stability to the entire ecosystem. See e.g. a famous review on this issue [1]. Other important factors might include novel protein antigens and small molecules we have not co-evolved with.
[1] Darwinian medicine and the ‘hygiene’ or ‘old friends’ hypothesis. https://pmc.ncbi.nlm.nih.gov/articles/PMC2841838