For fat vs sugar (ie: carbs), this was a very informative reading:
https://www.theguardian.com/society/2016/apr/07/the-sugar-co...Overall, I don't know of a lot of good science regarding which fats are better for you and which are actually bad. After all it was not until recently that it was admitted that the relationship between cholesterol in the blood and cholesterol is uncorrelated and not at all understood. Similarly even for calories, just because a food has X calories, does not mean you actually absorb all of those calories, let alone how the body uses them.
For the rule of thumb, I have no specific references and it is general knowledge I've picked up reading on nutrition. It could very well be wrong. I believe there is something to it, for example, coconut oil is relatively good for a person and has a low melt point, where-as bacon grease and steak gristle are pretty certainly terrible for a person.
Trying to find some references, I was not able to find the original reading where I stumbled upon that idea. This was a decent read though that I just came across: https://www.healthline.com/nutrition/healthy-vs-unhealthy-fa... (YMMV)