Anyone who has any basic understanding of thermodynamics knows that the human body makes for incredibly inefficient batteries.
Thus, the premise for The Matrix has a major flaw.
Which is okay; the writers dumbed down the movie from their original idea: Humans were part of the AI's operating system, the hardware upon which the AI ran.
Evidence: "The One": Certain people had the ability to manipulate the simulation, such as Spoon Boy and especially Neo. While a jacked in mind could "cheat" with their own body (i.e., the sim says your HP are at zero, but your mind keeps resetting the HP to max until the sim agrees), there is no mechanism to rewrite physics routines (a bullet's vector) unless the mind itself is somehow part of the calculation.
There is also evidence in the movie that there is a layered simulation, that Zion is just another sim like the Matrix. Otherwise, Neo would not be able to see Mr. Smith inhabiting the wetware of a human, and especially would have no vision while blind. Also, psychosomatic injuries are incredibly rare, and there is no evidence that anyone ever actually dies from dreams.
Thus, possible explanations behind the film:
1) "The Evitable Conclusion"... Final story in the Asimov collection I, Robot -- Robots remove the possibility of humans harming each other. In the Asimov story, robots take power away from those who are dangerous and guide humans toward agrarian but spacefaring societies. In the climax to the movie I, Robot, humans are put under martial law. However the means, in The Matrix, the First Law wins and humanity finds itself unable to harm each other because they're all jacked in. The War and Zion exists for those who notice the cracks in the sim, and is another sim diverts their attention inwards by pointing to a big scary enemy outside. Humans who die in the original Matrix sim would be ret-conned, like how the agents ret-con Neo before he takes the pill. They simply wake up thinking the really scary thing they just experienced was a bad dream. Humans who die in the Zion sim would be moved to a new sim; perhaps told the truth at last, perhaps just thrown into another stressful sim to keep them looking outwards. AIs would know that the best defenses are layered, and wherever possible, recursive.
2) Generation ship: These people are
colonists the great, great, great, great, great grandparents of colonists, and the easiest way to keep breeding stock healthy is to keep their minds active. When they're a couple generations away from their new world, the Zion sim will have the clouds parted, humans will wake up from the Matrix, and people will learn how to plow the newly fertile planet again, until the last generation which will be told the truth and actively prepared for colonial activities.
3) Better Than Life: The sim is better than the real world, in all of its layers.