Actually this was original idea by creators. But company forced them to end it with the silly "happy end & friendly cooperation".
The matrix is a story idea that uses a lot of factual inaccuracies to deliver the main story, which is of a world where humanity is actually inside a computer simulation. Humans being used as power generators? Utter nonsense. A RTG can deliver much more heat and some of the isotopes used even comes free as a result of nuclear fission power generation. Theoretically, you can indeed get more electricity out of living creatures if you hook directly to the central nerve stem as opposed to how much energy you need to expend to run such a system. However, the matrix system didn't use impulse electricity, they use body heat. The amount of energy required to keep a human being alive in such a condition, such as feeding, taking care of their poop, reenergizing their muscles so they don't deteriorate from unuse, would be a whole lot more than what they would've gotten from body heat. Humans are warm blooded, but we're not hot. RTGs are 100 times hotter than our bodies. Heck, a lit fireplace is hotter than our bodies. They could've just harvested energy from volcanoes.
Isn't it basically a random excuse of energy source to create a philosophical plot that is actually quite interesting?