I don’t think it’s likely that dieting is going to turn out to account for most of the difference because of how enormous the effect is, and because rates of obesity are roughly flat across (adult) ages, but middle-aged people have had much more time to try diets; if diets were messing them up, you’d expect to see some increased prevalence there.