The amount of food you eat isn't a habit. And I don't know what it is that makes people obese, but I don't think it's simply "bad food" as in the stereotype of bad food.
It seems clear enough to me that there is something - something - in the ecosystem that messes up the body's weight / energy homeostasis and we haven't identified the culprit. It might be a food additive, but it could be something to do with artificial light in the evening or plasticizers in our plastic products or who knows what.
Just my pov as non-overweight person who doesn't exercise (other than flipping my four year old around), doesn't walk or run long distances (but a 5 mile walk every couple of months doesn't phase me), eats very few fruits and vegetables, generally eats mostly meat, pasta, bread, cheese, cream and potatoes, and ends up in a fast food outlet maybe once a week on average.
recommended reading about the environmental factor hypothesis
https://www.lesswrong.com/posts/NRrbJJWnaSorrqvtZ/on-not-get...
it doesn't have to be just habit, but cultural/learned factors likely play a huge part.
each generation eats more, gets bigger, obesity runs in the family, (many obesity associated genes are mostly expressed in the brain ... the typical cursed environment-gene interaction), portion sizes got bigger, it became normal to gulp down a lot more sugar, etc.