Dude the processed sugar foods are engineered to get you to keep eating them. If you're interested in more read Salt, Sugar, Fat by Michael Moss. It is a phenomenal book that outlines how big food manipulates those three ingredients to create a nation of food addicts.
Amazing note on your mindset shift. That can be explained by our mental Pillar: CBT: Perspective.
You caught yourself with the common thought distortion of all or nothing thinking and rather than believing it you corrected your unreasonable response. That improvement played out is priceless, it gets you to realize there is no such thing as good or bad, on or off limits. Binary thinking is a root cause of perfectionism. Good on ya.
My suggestions on your energy drink situation is this: energy drinks are safe and totally fine sources of vitamins and caffeine. There are some novel ingredients in a bunch of them that a lot of people have issues digesting. But know the research on them is sound and they aren't poison in a can like alcohol. This suggests you can have them but with a few conditions: make sure they are zero calories, experiment to see if any of the ingredients cause stomach discomfort, don't drink any within 6 hours of your bed time.
If you're still not on board with those or coffee you can use individually dosed supplements to create your own energy mix. This is as individualized as it gets.
Start with simple caffeine pills. Buy them online and start with minimum dose of 200 mg. Use as needed.
There are some additional ingredients to consider but we can talk more about those if you think you need em. Start simple. You can end up with all kinds of concoctions. The already mixed and sold versions of these are pre workouts.