This right here is actually a steaming load of horse shit, though it's frequently trotted out as one of those down-home, simple livin', old timey bits of wisdom that by golly just sound right.
But horse shit it is. And easily refutable horse shit at that. If what you're saying is true, then clearly vastly more people would be dying from communicable diseases today than in previous generations. Except uh, that's not even remotely the case. How about that.
Wash your fucking hands with soap. Living like a filthy slob is not making you immune to jack shit. That's not how these things work. There is one thing that will make you immune to a disease—being infected, and beating the infection (or through immunization). Rolling in dirt and licking door knobs isn't going to do a god damn thing but get you and the people you come in contact with sick.