The sand and gravel in a tank using a undergravel filter does indeed contain much needed bacteria to convert ammonia to nitrites to nitrates. In our modern tanks with powered filters internal or external, that is much less of a concern and the bacterial presence in the gravel is very small. To get good bacteria growth, you need decent water flow and good oxygen content. Our modern filters have all of that flow going on inside them, not in your substrate.
As it turns out, the older advice to avoid disturbing the substrate was just wrong in many ways. Even on a tank using a UGF, the gravel needs to be well cleaned. It not only contained the bacteria but also contained all of the fish wastes. The bacteria grow in thin coatings on surfaces that get good flow and good oxygen so the surface of each bit of gravel became coated in bacteria. Unless you removed the gravel and scrubbed it, you would not have affected that part. Unless you cleaned the gravel regularly, you would end up with a layer of fish waste under the filter plate and the filtration flow would basically stop.
Do not be surprised when you find out that a book, especially one written some time ago, has advice that has since been proven wrong. It takes a long time to publish a book, not just to print it, and we learn things all the time. Many books are written by "experts" in their field who have accumulated information over a very long time. Unfortunately, the notes they rely on when writing may have been researched with the best information available at the time, many years earlier. That means the time lag on a growing and improving hobby like ours can be much too long to get all of the facts right.