It's so easy for even the biggest health nut to get trapped in these cycles when life gets busy! So definitely don't beat yourself up about it.
Practical things you might be able to do:
Ditch buying sugary treats for home, for a while at least, just to break the habit and cycle (harder to avoid in work canteen, I know)
Have a little think about the food available at work, is it even practical to take your own lunch/snacks? If no access for storage or keeping food cold, you will have to brainstorm for ideas on things you enjoy eating (critical or you won't stick to it!) that are available and practical to eat in the daytime.
Same for dinners. It does require an evening or two where you brainstorm ideas so you have a list or some ideas to work from. Easy, quick, tasty, healthy meals - things you enjoy, things that don't take long, and make sure you include some super quick meals (oven meals or eggs & bacon type) for evenings where you really can't spend any time cooking.
On evenings you can outlay a little time, batch cook and freeze (hoping you have a freezer!). Make sure you have space for storage before you cook. Do you like any meals that freeze well? There are websites which list meals which freeze well, which might give you some ideas.
Make sure you have some snacks at home that aren't whatever it is you're trying to avoid (crisps/sweets/chocolate/ice cream). Make it easy for yourself so you don't just walk to the shop and pick up chocolate.
Make sure you eat and drink enough (I know this will be hard with your job, so at least out of hours) to avoid the cravings. Don't starve yourself!
The first week of cutting down on sugar / chocolate is hell, but once you get past that it gets easier. I promise! And you don't need to deprive yourself forever - short term it's good to take a break and kill the cravings. It depends on your personality, but I'm OK with moderating chocolate - when I'm not starving I'm totally fine just having one chocolate bar (instead of 3 plus biscuits, plus other snacks). That is totally personality dependent though and I know not everyone can do that!