Your body may be craving the “quick energy” that it’s accustomed to.
Also, seems like I read somewhere that it could actually be a result of a nutritional deficiency like low sodium. Next time you crave sweet, take in some salt and see if that works.
The best thing I ever did for myself was get therapy, deal with trauma and get that process of self love going. I can relate to this experience, when I was uncomfortable then I would crave sweets, I’ve used it to solve emotional problems for almost 30 years. My last vice is that il smoke marijuana, I do want to stop eventually, but the only reason I mention it is because even when I’m on mars, sugar does not wield control over me anymore. I came up with an analogy that helped me, in the sense that i kept getting told “manage your triggers” that is your focus, but id never heard that i could just take out the firing pin with some long term hard work. I wish you all the best!!