I think it's both.
In my 20s/30s, I ate whatever I wanted, drank and partied too much, was naturally slim & never thought about it.
Late 30s, thought "I'm going to have this body until I'm 80+, better look after it". That meant more conscious choices for exercise and good nutrition, but not in a joyless way, it's a positive. I love food, it's one of the joys of life! It's much more about being healthy, active and able to enjoy all my sports and activities rather than just "slim".
I eat whatever I like, will happily do 3 courses and wine at a nice restaurant, or cake/dessert etc, but also have the awareness that if I over-indulge one day, the healthy and sustainable choice is to eat less & nutritionally better the next day.
It helps that I do enjoy fruit and veg more than carbs and junk food, so choosing what I want is usually also choosing the healthy option - and also, I believe that as I improved my diet, my gut microbiome also changed in response (over several months), so that it reinforces and supports those choices - tuning in and listening to my body, I'm more aware of what my body actually wants to power and feed it, and that's usually a healthy choice, not junk. Any desire for carbs/sweets/junk etc has certainly diminished massively.
Plus, I've never been much of an emotional eater, but I learnt to recognise those cues when it does happen, and do something else (for me, go dancing, climbing, or cold swimming), if what I'm feeling isn't really hunger, but misplaced emotions.