I can empathise with the OP. I went through a phase like that when I was younger, for years, where I’d easily get through loads of sugary food on a daily basis, shrouded in secrecy and self-loathing.
My body just got used to sugar and kept wanting more, I’d trained it that quick sugar was the default. I also found I’d get blood sugar spikes and crashes, so I’d feel hungry again quite quickly and reach for more of the same. I read multiple books on nutrition but it didn’t help me at the time and just made me feel worse about myself.
My weight yo-yoed a lot. I’d have periods where I could ignore 'the calling', but it would always come back. Then after about 15 years of this, I got into fitness. I started going to gym classes, doing other sports, and socialising with people whose hobbies were fitness-related, and that really helped shift things.
Now if I want a treat, I’ll make a big salad with lots of dressing e.g. proper olive oil, avocado, cheese i.e
things with fat that are actually satisfying, rather than reaching for sugar.
I also don’t keep chocolate, cakes or biscuits in the house. I’ll occasionally buy a slice of cake and eat it out somewhere, but if I’ve got a whole box at home I will still eat it all, even now, so I just don’t put myself in that position. I’ve refused those kinds of gifts before, and I’ve also thrown things away (taken out of the packaging so I won’t fish it back out). It sounds extreme, but I know my limits.
There’s a lot of research now around the gut microbiome. What you eat influences the types of bacteria in your gut, and those can in turn affect appetite and cravings. So if you’re eating a lot of sugar regularly, it can reinforce that cycle. I suggest you read up on this if you are interested.
I think I’ll always have that tendency towards sugar. It didn’t change overnight, but over time it calmed down as I shifted my habits and focus. Maybe replacing it with something else isn’t perfect, but it’s what worked for me, and I’m much slimmer, have more energy, and am much happier in my body now.