You for practical purposes can't easily immunize yourself to bad milk by exposure. The problem is two fold. In the first place there are over 2500 types of salmonella identified and surely more extant and as a product of metabolism they produce toxins that are deleterious to your health Salmonella being only one culprit as well. You are probably as safe as you ever were.
Your idyllic view of the past may have other challenges in terms of perspective. Firstly we tend to remember the good things and forget the bad especially since food poisoning can have an incubation of 1-2 days we may blame one sort of food stuff instead of another or forget that we were incautious with raw foods in the kitchen the night before and blame a restaurateur without good cause. We also may not differentiate between an illness brought on by food and one from a bug. This rose colored view is especially easy to adopt if we remember pleasant consumption and the costs were borne by another. Even with education and standards we have 48 million cases of food borne illness in the US and 3000 deaths annually.
This brings is to scale. Pasteurization can be trivially adopted at scale and has been shown to be effective. Maybe your dairy was highly sanitary had excellent practices that enabled a very much above average performance. Replicating it all over creation may not be tenable but universal pasteurization is.
If you want to see an interesting account of the real "good old days" before either of us were born you may peruse this.
https://www.smithsonianmag.com/science-nature/19th-century-f...
To maximize profits milk was thinned with water then recolored with dyes, chalk, or plaster dust with formaldehyde added to preserve freshness. Pureed cow brains stood in for rich cream and in addition to all the current maladies like listeria and salmonella consumers had to worry about bovine tuberculosis, undulant fever, scarlet fever, typhoid, and diphtheria.
> Those were the days my friend
We thought they'd never end
We'd sing and dance forever and a day
We'd live the life we choose
We'd fight and never lose
For we were young and sure to have our way