It’s never been as black and white as you’re saying.
Lot’s of medical practitioners will even advise you that it’s the quality of food you eat, more so than the quantity. Look at all the published research around processed foods and ultra-processed foods.
Other nutritionists will advise you that obesity is all about your macros. And that if you want to lose weight you need to increase fat and protein intake and limit carbs.
Others have argued it’s less about diet and more about exercise and having an active lifestyle.
There’s also a bunch of research showing that poor sleep might cause obesity.
Ozempic seems to have thrown all that out the window and says that one just needs to eat less if one is overweight.
All of those are permutations on the fundamental argument, not standalone arguments themselves. The idea with changing the quality of the food is that you'll eat less overall. Same with trying to adjust macros -- only unserious people suggest that calories are somehow different depending on source. The argument is that empty calories are less satisfying and will you to eat more overall. It is all just different approaches to finding a strategy for eating fewer calories overall.
> it’s the quality of food you eat
What metrics determine quality? How recently were those established?
It has always been black and white that the number of calories consumed relates directly to weight gain or loss.
Everything else is about tangentially-related issues. Eating 'better' food (and there are many definitions of 'better') may be healthier. Eating unprocessed food may be healthier, and/or digest more slowly, and/or reduce hunger. Eating different food groups in different balances (e.g. high protein, whatever) may affect how quickly you become hungry, or support certain exercise better. Low/no-carb/keto diets may help some people lose weight more quickly/easily, and probably results in a steadier blood sugar profile. Limiting eating to certain time windows and/or fasting may have some health benefits, and also contribute to weight loss. (And some types of regimen may suit some personalities better.) Eating certain types of food (fat, protein, low-GI carbs) which are also not processed may digest more slowly, resulting in a steadier blood sugar profile and less hunger. Etc.
And despite all of this, it's also possible to lose weight by eating the worst food in the right quantities. See [0] or just Google the "Twinkie diet".
[0] https://www.huffpost.com/entry/chewing-on-the-twinkie-di_b_7...