Honestly, mistreated cows don't produce much milk.
That's a simple truth that many people refuse to internalize. There are externalities around the process that are not good, but the actual treatment of the cows themselves is not one of them.
No, the real reason why dairy is so relatively cheap is because modern cow breeds are able to produce gallons of milk per day. Up to 12.5 gallons per day from the best producers, but usually 6-8 gallons.
By the time a calf is a month old and ready to start weaning to solid food, they're consuming about 3 gallons per day. If you do the simple math, you see that even while a cow is nursing, they still need to be milked or else they will be in pain from the milk fullness.
Cows can then continue producing milk for another 9 months before they naturally stop.
All that said, there is still some cruelty here. Just not in the milking process itself.
Calves are usually allowed to wean naturally, but after that, the males are either sold to auction, or sent to pasture for a bit under a year to grow to adult size for slaughter. The ones sold at auction actually have a pretty good life, they live as stud bulls and could live for quite a long time. Could. Some farms swap out bulls every 5-6 years, either through trading bulls, or sending the old bull off to slaughter.
The females are kept by the dairy farmer to be turned into the next generation of milk cow,
It's theoretically possible to get 10 years of production out of a milk cow, but usually farmers will send them off to slaughter after 5-6. It's the reason why they don't keep their bulls more than 5-6 years, you have to rotate the breeding stock to prevent inbreeding.
The other source of cruelty is veal. Most veal in the US is going to be Red Veal, a grass fed calf slaughtered at around 22-26 weeks. That's at roughly 700lbs on the hoof.
I said most. The sad truth is there's a product called Bob Veal, that's claves slaughtered within days of birth. And then there's cage veal, which is explicitly banned in half a dozen states and frowned on in two dozen more. Cage veal is often a form of White Veal, where the calf is artificially prevented from ever really eating solid foods. They are often fed a fortified milk formula for their short (20 week) lives.
Veal is not as popular as it used to be, mostly because kids started learning that it was made from baby cows. Red Veal is still pretty popular, but if you have the pasture for that, you might as well just leave the cow to grow for another couple months to increase the sale weight. Almost every dairy farm in the US with excess male calves lets them grow to adulthood before slaughter. Or sells them to people who do, it's much the same thing.
There's one more thing that's drastically reducing veal production worldwide, there's a widespread tech called gender selected breeding. You get a bull to mount a mechanical harvester (which is super easy to do, they're horny bastards) and then you run the sperm through a process that removes the male producing sperm. It's something like 95% effective at ensuring a female birth when used to inseminate a cow.
For most of human history, bean juice wasn't available. Also cheese, a nutrient rich food that can last years if properly stored. Tofu is good, but it can't last more than a few months.
That's still a reason why milk and cheese are popular, they kept our ancestors alive, and continue to be good sources of nutrition today.
I realize now that in my edit and re-edit I lost the thread.
Basically the reply was that cruelty was never the point (except for rich people, like hereditary nobility. They often revel in needless cruelty) the point was survival.
That's less an issue to the modern Western world, but is still an issue in a bunch of areas.
Remember that we're less than a century into even being able to have semi widespread veganism.
For thousands of years, vegetarianism either came with a serious risk of nutritional deficiency, or was supplemented with milk and cheese.
So rejoice that it's even possible to remove animal products from your diet now. Just know that it's still not possible for the entire world.
Until it is, dairy farmers will continue to mitigate and harms that they can, because a happy cow is a productive cow.
I did have a friend in high school whose family owned a dairy farm. I helped with the milking a few times... But it was mostly an excuse to go over to his place to get stoned, and I've not actually talked to my high school friends in over 20 years.
So yeah, most of the write up was a few google searches, but I did sort of know the basics to know what to search for.