How much calories your body extracts from food and subsequently stores is not a constant. The thermodynamics argument basically ignores how human body works, but hey, it is simple.
Imagine we study you for a year. We put you in a box, we control your food intake; we strictly monitor the amount of exercise you get.
The first six months you stay the weight you are now. We then introduce a single change: we put you on antipsychotic medication. Nothing else changes: you're eating the same type of food and in the same quantities.
You will gain weight.
Is that because thermodynamics is broken? No.
Is it because you're "undisciplined"? No.
Is it because the antipsychotic medication is full of delicious calories? No.
It's because your carbohydrate pathwathway has been altered, and you now process carbs differently to how you used to.
Dopamine antagonists shift patterns toward favoring fat storage over muscle building/maintenance. They don't just reduce the amount of calories burned, they screw up the low-level regulatory mechanisms. AFAIK you basically have to starve yourself to bring blood sugar down to normal levels, and of course that's unsustainable.
The fact that your body can change the number of calories it burn disproves nothing. For example, the more weight you lose the fewer calories you burn, thus your calorie intake must lower to sustain the same deficit.