A new paper in Nature Genetics describes research into the bacteria in ancient teeth plaque. When modern food came along, the bacteria became less diverse. One of the researchers said :
The composition of oral bacteria changed markedly with the introduction of farming, and again around 150 years ago. With the introduction of processed sugar and flour in the Industrial Revolution, we can see a dramatically decreased diversity in our oral bacteria, allowing domination by caries-causing strains.
Whether the decrease in diversity was due to (a) more sugar and flour or (b) less bacteria-laden foods is hard to say.
Again, data suggest we need bacteria to protect us against bacteria. You’d never know this from food safety laws or how freely pediatricians prescribe antibiotics. Again, it is hard to know without more research what caused this or that historical change in health (e.g., more tooth decay when sugar and flour became popular). The obvious answer (e.g., sugar causes tooth decay) might be wrong. If you believe that cavities are caused by too much sugar, the solution is to eat less sugar. What if cavities are caused by not enough bacterial diversity? Then other solutions might work better, such as eating more fermented food.