Yes, correlation is not causation. Weight gain often occurs as a response to various diseases and may have a protective effect. Side note: back in my training days I worked with two clients who maintained that their weight occurred *after* being diagnosed as diabetic. Also: gradual weight gain through adulthood appears to be a natural state of affairs.
BMI is a a nonsense number by itself. As you stated; it’s critical to correlate BMI with fat %. I’m 162 and am considered overweight. My fat % runs between 9% and 12. Makes for very veiny legs and arms. I just hit 56; I definitely notice I’ve lost muscle mass in the last few years. I know what I have to do; it’s just difficult for someone who would prefer no food to stuff I don’t like. Additionally I’ve tried to keep up with 5-6 day a week exercise routine at a 750-800 calorie per hour burn and it’s getting harder and harder. I’ve torn left and right bicep; shoulder; left calf(skiing) and further crushed my L5 disk doing dead lifts this year. I still run a 5.5 mile 1500 foot ascent/decent run 2x a week. Sometimes more. I just work through the pain; live on ice and heat.
One of the reasons I got out of fitness training is that I got tired of hearing people beat themselves up … like what I’m seeing now. No, you didn’t gain (or regain) because you “took your eye off the ball.” Yes, of course movement is good. Functionality is its own reward. On the other hand, age - and it’s attendant aches and pains - have to be reckoned with.