How do you undo several years of self inflicted psychological damage on your own?
In much the same way you’d heal from damage inflicted on you by others. First, you try to understand why such a thing occurred. In both instances (self-inflicted damage or damage from others) the likely answer is that somewhere along the way (hint: probably in your earliest years of life), you learned that you deserved to be hurt (or at least not protected) because you were not of sufficient value to be loved and properly cared for.
These early lessons become internalized voices which later form our self-identity. It takes a lot of work to learn that you, in fact, do have a value, and are worthy of love, when you’ve repeatedly been told directly or indirectly otherwise.
Psychotherapy is an excellent forum to explore your inner self, and better understand why you are the way you are, and eventually learn to become a better version of you, that comes out of your own wishes, desires and self-reflection, as opposed to the stories others have told you about yourself.