What you're talking about is a kind of willpower, which funnily enough has a biological basis also. Genetics seems to play a role, as do many medications. The marshmallow test seems to show willpower largely stays the same over 4 decades. Ozempic also seems to show you can artificially induce it. It's not mind over matter, it's having a mind primed to do it in the first place. It won't be as easily taught to someone who grabs the marshmallow instantly as a preschooler. We also seem to be able to induce it these days with ozempic, which is fascinating.
I don't think Ozempic operates on willpower... it slows your digestion process, which makes you feel fuller longer and can make you incredibly ill if you overeat.