There is an interesting theory on Polio which addresses this very issue. Children who were allowed to play in dirt and get dirty seemed to have a greater immunity to the disease than were kids who were restricted in their playground activities and forced to continuously wash themselves........
There’s also been a theory posited that the large increase in asthma and allergies is due to parents not letting their kids outside much, and then not letting them get dirty when they do. Something about how the underdeveloped immune systems of children recognize asthma/allergy antigens as their own. Those not exposed to these antigens as young children see them as foreign when they get older, which sets off the attacks.