People who grow up with untreated water do in fact have resistance to the pathogens in it. See: https://en.wikipedia.org/wiki/Travelers%27_diarrhea
> A study among expatriates in Nepal suggests that immunity may take up to seven years to develop—presumably in adults who avoid deliberate pathogen exposure.[18] Conversely, immunity acquired by American students while living in Mexico disappeared, in one study, as quickly as eight weeks after cessation of exposure.[19]
I suspect it's your gut flora that adapts; but it's not your DNA.