Similar story to me. Academically fairly gifted from an early age, testing high IQ later (I know, I know) and was recommended to be placed in an advanced school.
My parents were modest and didn't pursue this, nevertheless, everything was easy until it wasn't. The part I never learned properly was effort=reward. I was also diagnosed with ADHD and was on ritalin for several years.
Later school years were bad for me because it involved a lot of rote learning. I did not have the discipline to do this and my grades slipped back to mediocre. University was better and I did very well again. I've done moderately well in my career, top few % of earners but I am unable to break higher because I'm constantly distracted and struggling to complete mundane work tasks which prevents me from getting to the top where my ego says I belong.
I take full acknowledgement of issues, I know it is my own doing. I don't know if it is too late for me to change but I'm slowly (because even here I lack the focus) trying to learn technique to change my entire approach. I've recently started looking at the power of habit forming as a means to improve discipline. I think I could benefit from a very tightly structured day where one thing naturally leads to another. Otherwise I tend to drift in and out of tasks and end of up the web, like now.