I recognize that pattern of self-beratement, and it becomes reflexive like a tic or scratching an itch, but then it happens so much that eventually it can become like a sore, with all the consequences. It can also mean the cruelty you have for yourself sets a threshold where the accidental cruelty you have towards others doesn't even register because it's not nearly as bad as what you do to yourself. If you can recognize that the self-berating pattern can have collateral damage on people it would break your heart to be cruel to, it can make exercising compassion a priority.
One of my favourite discussions of this was in the animated series Midnight Gospel, where the fellow being interviewed talked about the Buddhist perspective on what was essentially people's lack of self-compassion as recognizing that, "you're grinding in Minecraft." Man, Buddhists are assholes. But well worth listening to.