Bacteria are relatively simple (opening myself up on that one- they really are not simple at all, "relatively" is the operative term) single-celled critters.
Some, the autotrophs (which include nitrification bacteria) generally live quite firmly attached to a hard (their definition, not ours - to them a sponge or floss is hard as it is solid and inert) substrate. They get everything they need to live and grow by in-taking/uptaking material dissolved in the water which is almost entirely inorganic (no carbon chains, proteins, cyclic hormones, etc.) . From that dissolved material they produce all the proteins, fats, etc. - the organics that make up their cells and walls - that they need. They have the "simplest" diet, as it is inorganic.
Others, the heterotrophs (generally much faster growing than the autotrophs and numerically the biggest part of the bacterial mass in a tank) tend to live on particulates also, but on organic to partly organic particulates. They need/want/use organics to start with. They are the great digestors. A fish poops - that poop contains some undigested unabsorbed food (percent depending in part on how badly the tank is overfed - in worst cases it is the majority), in part fish waste products secreted into the gut, and large numbers of gut bacteria. The bit of poop falling to the substrate already has some functional bacteria (some of the gut bacteria will not like the O2 level of the open tank, but some will) and will quickly be colonized by other species. All those bacteria in concert will break down the poop into smaller particles with lower quantities of organics. Those smaller particles will get picked up by the filter and hopefully trapped in the mechanical media there, where the breakdown to even lower organic loads will continue. Some of those particles will sift down in the substrate, where the O2 levels are lower and similar bacteria which like less oxygen (faculative anaerobes and anaerobes) do essentially the same role of extracting and using the organics. The resulting "mulm" (the tank equivalent of garden compost) is "mineralized" - the organics are extracted to build bacterial mass, the inorganics are a bit enriched, at least relatively so. These bacteria have much less simple diets, as theywant/need/use organics. What they leave behind is mineralized as it has little organic, primarily mineral materials left.
When we partial we remove masses of heterotrophs and thier ilk from non-bacterial realms, especially when we vacuum, and the same when we rinse the mechanical filter media.
Tanks have huge biomass in comparison to natural waters, in part because the fish load is so much greater, but also in part because of the added food (also greater to much greater than in the wild) and the massive bacterial presence needed to mineralize alll the intermediate results of that.
Bacteria are master recyclers. If there is an excess of this of that bacterium species, it can and will eat itself out of the food supply and die back. But others will consume the residues and continue - and the die-back is rarely total, only partial.
The dangerous losses to the tank over time are mainly to the natural buffering systems - carbonate/bicarbonate - such that the tank build up excessive acidity if not partialled to replace that. But mulm itself can build up to excessive levels also - then you also get the peculiar members of the food chain multiplying to the levels of notice - BGA, nematodes, planaria, hydra (in non-fry tanks) etc. as the infusoria on which they live are multiplying due to the enlarged (built-up) mineral and organic base. That organic base does include the total bacterial/infusorian mass present in the tank.
Heavy enough?