((((hugs))))
Whew! I sure can relate to what you're talking about. I have the same tendency, and it's a
really difficult habit to break!
I am unsure of when I started, but it was back sometime in my early childhood. I know that much. And all throughout, I had people telling me that I should be happy with what I had, otherwise I'd be miserable. Very true, I was aware of that already, but they also didn't know how rough I had it either.
In retrospect, perhaps part of it is plainly feeling sorry for ourselves. I abhor having to come straight out and say it, because it's painful for me too! I'm a lot older than you & have been feeling sorry for myself for 35 years or more!!

I've also kicked myself and suffered self-hate for just as long. Great combination.
Tips that work sometimes: comparing your life to those who have it worse than you do (like in foreign countries); volunteering to help those in need (there are LOTS of great volunteer organizations, both local and worldwide); looking in the mirror every day and smiling at oneself; reminding yourself to focus on your good traits, ones that you currently have (not ones that you're hoping to someday attain).
I think that DBT made me feel most positive about accepting things that I cannot change. It didn't cover ways to make myself stop putting myself down, other than focusing on the fact that feelings aren't facts. It was very difficult for me to apply that in my daily life however.
As you can see, I hope, you aren't alone. It sucks ~ but it is where we are right now regardless.

We just have to keep on trying to find the healthy way to boost our self-esteem and outlook upon our lives.