My headcanon for The Matrix’s “humans are batteries” is that it’s the machines’ perverse interpretation of this — killing the humans is off the table, and for whatever reason letting them live with no purpose to serve the machines is also disallowed. But giving their lives “meaning” in the form of a shitty (and thermodynamically dubious) “battery” somehow satisfies the rules.
It’s a very big stretch, I’ll admit…
Except they kill humans all the time.
I think it’s just easier to accept that there is an unexplained reason why humans can generate some kind of power that’s useful to the machines for something at some point between the winning of the war at the point of the movies.
Just ignore the fourth movie.