You see it is complicated.
My weight goes up and down a lot but I am always around a size that I can live with and feel good about the way I look.
I tend to reward myself with food (you did well you can eat it) or cheer myself up with it (your day was shit, you deserve it).
It is a very dangerous approach. When I am down I can easily spiral out of control and I am done. Then I would have to catch up in the gym for months.
If you are seriously depressed you don't care that you live in filth, that you wear dirty clothes, that you smell and certainly you do not care how you look.
Not everyone can lift themselves up from that.
Sometimes looking good is a motivation in itself, but if you had been subjected to abuse or are severely depressed it is just not enough.
And yes, you do it to yourself. Sometimes because you want to punish yourself, sometimes because you just want to hide.