Too many helminths seems to have deleterious effects, however, so there seems to be a balance that must be struck.
There is evidence that these worms affect the microbial mixture in the gut.[2]
Generally speaking, modern humans live in sterile conditions whereas we have ferocious immune systems which evolved to handle filthy conditions. The theory is, given too little work to do, some people's immune systems start to attack the self.
Anecdotally, I have an incredibly healthy daughter; we never hesitated to expose her to as many strangers as possible. "Would you like to hold our baby?" She also got mother's milk for several years (advantage of being an only child). Almost never gets sick and when she does, it's for less than 24 hours. Hopefully it stays that way :)
1. https://www.healthline.com/health/crohns-disease/hook-worms#...
2. https://www.sciencemag.org/news/2016/04/parasitic-worms-may-...