Evolution doesn't have end goals like building the most powerful computer possible. If caloric excesses are a factor, it's because there was some other selective pressure that made use of the energy to support more neurons. But even then, more hardware isn't the same thing as more intelligence. Elephants and whales have bigger brains than we do. Shrews and birds have a higher brain/body mass ratio. None of them are intelligent to the degree humans are. An explanation for human intelligence has to explain us, not just our brain mass.
Sperm whales may have more massive brains, but they have fewer cortical neurons total, and of course a much smaller brain to body mass ratio.
But more importantly for this conversation, our brains use up a staggering 20-25% of our resting metabolic needs. A whale brain uses something like 3%.
For us to be able to devote 20% of our calories to our brains, we simply needed to have a huge excess in the number of calories we had available. This is why the cooking hypothesis makes sense. Once we were smart enough to get lots of excess calories, that opened the door to this new fitness landscape of organisms that could devote a ridiculous proportion of their food to their brains. It wasn't that we gave up something else, it's that this wasn't even a possibility before.