You are not a machine
It's easy in this world to treat ourselves badly - we work too hard, we exercise hard, we tear strips of ourselves for the tiniest mistake. There are complex reasons why we do these kind of things but let's not get tied up in knots trying to figure out why we are like this or that. We are not machines - we need to take care of ourselves in some way. Once we lose this connection with taking care of ourselves then we become lost in these other behaviours.
Are you taking care of yourself right now? Do you even know what that is?
Perhaps you think you don't deserve it. What kind of thought is that? Who doesn't deserve a little comfort and care in this world?