I don't think you're being unreasonable to feel ashamed - I think that's a reflection of you having taken responsibility for yourself and realising that (on the face of it) the damage was unnecessary. It's a horrible feeling.
The reality is so much more complex than that, though. Most people don't choose to be overweight and there are so many factors which come into play and cause it - what your genetics are, how you were brought up, whether your parents helped teach you about food / cooking / a balanced diet, whether your parents demonstrated a healthy relationship with food, have you had the funds to buy good food, have you ever been into sports / exercise, would you even know where to begin? The list goes on. And that's without considering any mental health issues, eating disorders or life events that may have had an impact. Plus, you were a child. You (and we) can only place so much expectation on a child.
I understand the feelings you're having because I have them, too. I was in excellent shape until my mid-20s... I had a fabulous upbringing, I had money to afford a good diet, I was very sporty from the age of 3... I had no excuses or reasons for not being healthy... And, yet, I gained 5 stone over the course of 10 years which saw my BMI go from 22 to 35 - 8 stone to 13 stone - a healthy weight to morbidly obese (I'm very short, in case you're wondering).
Life has changed for me and I'm now able to focus properly on myself. I've made sustainable changes to my lifestyle and the weight is coming off, slowly. I'm about to hit the first stone lost marker. But I can already see and feel the damage...
My knees are absolutely shot and I need surgery on them both, my boobs now sag (when they were once pert), my tummy hangs and I'm worried about how loose my skin will be when all the weight has gone. I've been asking myself the same questions as you... Why did I do this to myself?!
But, do you know what, those questions aren't helpful. Thankfully, as humans, we are able to grow and learn and improve ourselves throughout our lives. We won't always get it right but, when we do, we should celebrate that, and learn / be motivated by the positives rather than chain ourselves down with our mistakes of the past.
What you have achieved is nothing short of incredible and, while, yes, there will be some scars that live with you, there is so much good that you've done that's invisible. Just think about how many years you've added onto your life and the quality of it, which will be so much better. And you've not even finished your journey, yet!
On a practical level, if you're able to get yourself into some strengthening exercises (for example, pilates) and walking, I expect you will see a huge reduction in the pain in your knees. I certainly did, when I took that approach (and that's with huge areas of completely worn down cartilage in both knees). I honestly couldn't walk, they were so bad, but I pushed through until I could comfortably walk 7 miles per day and they felt sooooo much better. I also lost 2 stone while doing it (unfortunately, it went back on at a later date) which will have helped, too.
Please, please don't beat yourself up. You really need to be proud of yourself and celebrate your success. The past is the past - you can't change that - but you can change the future. You absolutely haven't ruined it - you have so much going for you and to live for. Be happy. Enjoy life. Make the most of it.