There are a lot of human needs that aren't met in this world, such as access to clean water, shelter, and food. You are legally not allowed to deprive a pet, for instance, or a farm animal of those same things.
Also stated "You would be locked up if you treated an animal the way we treat other people", and other statements about how great animal welfare is in the world of agriculture.
There are plenty of animals in the woods for which we don't provide food, water, and shelter. We don't put people in jail for not providing for woodland animals. So if you treat wild animals the way you treat wild humans you wouldn't be "locked up".
The only reason that we need to provide those for farm animals is that we have imprisoned them within a fence that they are unable to escape from, and because we are fattening them up for slaughter to get as much money out of them as possible. But that's not a defense in any other context. For instance, it can hardly be a defense against taking hostages that one gave them a bottle of water and some food in the days leading up to the filming of the execution video. It isn't a good defense in the case of animals either.
If we compare these few positive things we do for animals - giving them food, water, and shelter - with the negatives - the imprisonment (often in confined spaces standing in their own filth), the separation of calf from mother, killing them at a fraction of their lifespan, and the practice of gassing or shredding them alive - it would be hard to deny that the negatives of having to find one's own food, water, and shelter outweigh the positives of not being thrown alive into a shredder.
But this argument doesn't consider those negatives; it just counts the positives and ignores the negatives, a technique that inherently can be used to justify any moral action. This is no different than stealing someone's car under the premise of "freeing up their garage space" or some similar absurd justification. Yes, surely anything sort of murder has a silver lining for the victim, but is that really a justification?
Slaves are given free food, water, and shelter. They aren't asked to pay any money for those things! But we wouldn't say that giving slaves free accommodations justifies slavery, in the same way, that it doesn't justify animal cruelty. It can't be said that we are "giving them free care" when the animals pay a huge cost in the form of their abuse. Especially if we wouldn't choose such a situation for ourselves