For many people, it's the same as substance addiction, cutting, or whatever else takes the pain and gives you comfort. Yes, trauma is involved in a lot of these cases.
Some people say they would rather take a pill than eat. For me, this is inconceivable. Food is a huge part of my life. In my case it's cultural, but still, it would be hard to think any other way.