Actually, I can do basic math. I'm not an idiot. And you are missing some situations where POPs using energy is inferior to POPs using food.
Let's start with this wonderful, paradise planet:
View attachment 245560
This planet, the Risa-like resort that it is, generates only 5 food to support its population. It only generates some food because I need a capital complex, and capital complexes generate more adjacency bonuses/minerals than just putting a mine there.
Thanks to slavery (none of this regulated slavery nonsense; I'm running the hardcore kind with slave processing facilities and everything), the starvation on this planet matters not at all. Who cares if the slaves starve? Worst case scenario, I have to grab a POP from a breeder world if a POP dies/goes on the Interstellar Railroad for 50 influence. If these POPs ate energy instead of food, this planet would consume 22 more energy than it does now.
Note that it is not as efficient, but I could hypothetically accept the slave penalty to energy (-33%) and starve slaves harvesting energy. I could give up all the farms on a slave-energy planet, build extra power plants, and come out a bit ahead on energy. If those slaves were instead synths who ate energy, I couldn't do that.
(This approach doesn't work with science production and labs, obviously, as the penalty for slaves doing research makes labs manned by slaves pointless.)
There are also plenty of bonuses to food production that do not depend on buildings. Slaves benefit from just being slaves (+20% to food), pitharan dust (+20%), stimulant diets (+5% repeatable), and the agrarian trait (+15% when working a food tile). (The slave processing facility adds another 10% to food, but it uses energy and takes up a tile, so it might not be the best way to generate food.) If you are running a slavery based empire with the right resources, techs, and species traits, there might be benefits to producing food in lieu of energy.
Remember that the capital is basically free food. Capitals do not cost energy, and they provide adjacency bonuses, so you really shouldn't replace them with something else (even if you don't need them to build upgraded buildings after you build the upgraded buildings). This means that the first 2-7 POPs on a planet cost food, but that the food cost is irrelevant since it is covered by the capital (depends on which capital you currently have and what food resources are on the tile the capital occupies). Remember that all the bonuses to food production can be applied to the POP farming the capital, so you can leverage the food on capital with slaves and agrarian POPs.
Let's also consider that the orbital hydroponic farm will produce 3 food for the cost of 1 energy.
So, depending on the situation, you might be able to feed a planet with up to 10 POPs for the cost of 1 energy
and since you can't fill a star port with multiples of the same kind of module, that orbital hydroponics farm isn't sharing an opportunity cost with solar panels that produce 3 energy. In this situation, if the POPs consumed energy instead of food, it would cost the empire more.
What about a planet with 18 POPs?
Let's assume that the planet with 15 POPs has two tiles with 1 food (this is not unreasonable). We put a planetary capital on one tile with agrarian slaves and pitharan dust. Let's put a tier IV hydroponic farm with an agrarian slave and pitharan dust on the other tile with inherent food. Let's assume they are
not adjacent, since we probably want the adjacency bonuses to be reserved for energy production. The planet also has both an orbital hydroponic farm and solar panels.
So, a hydroponic farm IV on a tile with 1 food can worked by an agrarian slave can generate 8.7 food (5 food plus 1 from the tile with pitharan dust and slavery and agrarian). The capital generates 7.25 food (4 food plus 1 from the tile with pitharan dust and slavery and agrarian). The orbital farms grant 3 food. That totals 18.95 food.
The energy cost of these buildings is 3.5 energy (orbital farm plus hydroponic farm). But we need to account for the opportunity cost of a farm replacing a power plant. A blank tile (no energy) with a power plant IV would produce 6 energy. But we would obviously also have a power hub, so let's add 20% for the power hub. So, that's 7.20 energy (assuming mediocre happiness in the range of 50-60%).
So, if we replace a power plant IV for with a hydroponic farm IV to generate food under these conditions, we end up losing out on 10.7 energy to generate enough food to feed 18 POPs. If those same POPs consumed energy, it would cost 18 energy.
In this situation, food generation saves us some energy
even though we have to replace a power plant with a farm.
To be clear, in many cases, food costs more energy than it saves due to opportunity costs. In many cases, you'd rather have a power plant than a farm on a planet. But this does not apply in all situations.
EDIT: I didn't even invoke all the bonuses. I could redo the math for an iron fist governor that can force slaves to generate even more food.