Notice how we train animals with treats: sniffing drugs, attacking robbers, etc. It's a powerful behaviour modulator.
Our brains are no different. In a pavlovian way, we reinforce behaviours that give us a sugary reward. But in our case, the feedback loops are really short. Instead of doing a difficult task, our behaviour to get the reward is simply going to the kitchen and opening a snack.
Do you ever get the feeling, after a meal, that you feel like having "a little something", like a sweet? To me, that's like a learned pavlovian behaviour. And every time we cave, we reinforce that automatic response. It can be anxiety-inducing not to do the behaviour.
The question in my mind is: how do we break this pattern? Because it's easy to do it once, but it's statistically hard to keep it up many times. You will slip up and reinforce the behaviour again.
I am becoming increasingly convinced that we need to change the environment around us, that is, regulate the amount of added sugar in foods.