While this is only anecdotal data, this is not true for me. I was a skinny kid because I never got soda, I never got ice cream truck, I never got pizza or pasta, and if I spent more than an hour on the computer (note: I'm a programmer now) my mom would yell at me to go outside and bike, or drag me to the local beach or town pool for the day.
Well, all that forcing me to eat "proper" instead of teaching me to eat "proper" built up quite a bit of resentment apparently, in my freshman year I gained 20 lbs and kept going (with swings up and down) and I have not seen 185 lbs since then.
I'm currently 6'3" and ~260lb @ 46 years old. Last week I worked out 4 times (all Orange Theory, which is no joke). I'm about to work out again in a few minutes. I'm trying to watch what I eat, considering going back to calorie tracking but IT IS SUCH A PAIN. The tracking is more of a pain than the eating less, lol. (I'm also ADHD, which might explain why.)
Speaking from my own experience, I eat pretty healthily, and cook most of my own meals. The few times I've had anything sweet in the last decade, I could only handle a small amount of it before my brain and stomach were telling me I've had enough. If I push myself, I began to feel ill. (Example: 4-5 Sweetish Fish is enough for me)
My own defense mechanism is because of my parents. They never bought soda and sweet snacks (e.g. gushers, fruit roll ups) at the grocery store, although a handful times a year I got to go to a candy store and pick out a couple items.
I would guess (based on anecdotal experience though) that a child's diet is the number one cause/preventative of obesity. It sets the culinary stage that they will dance on for the rest of their life.