If I have en envy for say, cookies. First I will cook them myself. That leads to 3 things:
1. I need extra motivation, 20 or so minutes + more dishes to wash on top of the rest of the usual daily cooking.
2. I use basic, raw ingredients I control and not something stuffed supplements, fructose, palm oil and other bad shit.
3. I won't eat them all like there is no tomorrow because I know the value of them and I will have to make them again next time I want some.
Having said that I don't refuse the weekly ice cream (but it comes from an artisanal ice cream vendor, not the stuff from the supermarket) and won't give up on the occasionnal restaurant.