My 2c is that one should simply look at the diet of lifestyle of the fat people they know, and the obesity problem will become clear.
Tons of soda. Products like Hamburger Helper instead of actually making pasta and sausage yourself. Extremely high volume of food in general. Constant, constant snacking. No exercise. So a massive amount of low quality food and nothing to burn it. Cancer, heart disease, joint pain, diabetes, heartburn, everything else.
Occasionally you run into some outré example like a family I know who eats exclusively home-cooked meals with grass-fed beef and venison yet are all overweight, but I've had lunch with them and that was some of the richest, tastiest food in my life plus all the trimmings. Also, they don't really care about exercising, or for that matter their weight.
I don't think this is complicated. Weight gain is simply calories in and calories out. The only contentious part is the psychological compulsions that cause people to eat amounts of food that they know are bad for them, sometimes while maintaining a sedentary lifestyle, which they also know is bad for them.
If you start baking your own bread, there is a pretty high chance of gaining weight. The reason is that you're still eating the same volume as before, but this time the bread is more calorie dense. (The supermarket stuff has less calories.)
More vegetables in your diet on the other hand does typically lead to weight loss, due to consuming less calorie dense food and still triggering your 'I'm full' stomach alert.
But eating pasta isn't healthy either, due to the plate being mostly filled with high-calorie foodstuffs (even if you do choose the wholegrain stuff). Pasta recipes typically do not have the vegetable bulk to fill up your stomach. Vegetables are low-calorie.
As for processed foods. You shouldn't be eating most of it but the better stuff tends to be pricier and unaffordable for a significant portion of the Western population.