It doesn't matter why you want to eat, all that matters is how you treat yourself when that happens. There's no right/wrong justification to be made. There's not even a right/wrong action to be taken. The answer may be "it varies." Be kind to yourself regardless. Pay attention to how you want to feel regardless. Even if you do want to eat lots of food just to numb out and comfort yourself, that's the signal to be extra kind, not to go, "Ah-ha! I knew you were just being weak and greedy." If you're physically hungry, be kind. If you're mentally restricting, be kind. If you're feeling tired and overwhelmed, be kind. Whatever the cause, the answer is the same.
Sometimes kindness will look like cookies and sometimes it will look like getting outside, or taking a nap, or making a satisfying lunch, or leaving the kitchen and watching TV. Ask yourself, what is the kindest thing I could do right now? Then, whatever you choose, own it. Know that your intentions were good. No punishment or guilt is forthcoming. Then you can relax and discover what truly feels and works best for you, unlike when you're in your head with all the "shoulds."