Managing the Primitive brain

I’ve lost 40 pounds so far and have mastered a lot of the weight loss skills. The one I want to get better at, and will help me lose the last 10 is managing my primitive brain. I keep making this same mistake- I do a write it down and move on worksheet, I know what’s at the root of it, but when I’m in the moment my primitive brain truly believes “it doesn’t matter” and that it’s more important to eat right now. It’s when I get a stress/tension headache and need to take Advil. I also feel super hungry, and my brain tells me that food will help the headache and plus I need to take it with Advil. In my protocol, I put if I have to take Advil Im allowed one handful of nuts. I think the relief I feel from eating those nuts drives me to think “f-it” I feel terrible and this is helping. Any advice here? I really appreciate it!!