Some people don't even get boats my friend, they have to try and succeed on a plank of driftwood. I hope you don't have a midlife crisis either, but chances are pretty high your not going to end up exactly where you thought you would be, and hey maybe that ends up being a good thing. Maybe your horizon was okay but you actually lucked into something you loved more.
I was shocked by the cookie cutter midlife crisis I had upon hitting 40 despite thinking I was doing all the right things before that.
EDIT: my question comes across as combative and snarky. I honestly hope your strategy works out. Just for me the life I now enjoy in my 40s is not one I ever thought I'd want and it was a rough fews years getting over that.
One complication is that we all follow different paths through life; those older people didn't get to where they are by going further down the same path you're on.
Also how do you know what your 40 or 60 year old brain will think when you are 20?
If our brains thought the same things and had the same world view this would be evolutionarily a disadvantage. Just brain chemistry changes alone could account for a lot of decisions. At a crude level it makes more sense to be sex and love obsessed in 20s when the chance of having a good sperm, eggs and pregnancy is much higher.
Elder members of the group help genetic survival by providing wisdom, knowledge of a different kind than younger people (I don't believe "older people know better") but the blends of knowledge are great for survival.
The assumption that we are purely rational agents making informed choices is clearly false in general, and I think the opposite is true, in general.
And this doesn't even tough on the extra information you would have processed over 20 years or even the freakingly high speed of change of the world around us. Would you choose to learn about Machine Learning / Neural Nets in 2000? Or coding in 1980? Well you could if it is a passion, but it didn't look as promising as now right? So data changes.
Having helped a couple of people going through that sort of phase, a pretty useful tool I found was to have them think about how much the world has changed in even just 20 years. So, given that, it isn't really that big of a deal that at 40 you might want to do something completely different from when you were 20, simply because your current life is almost entirely different to what it was 20 years ago.
We're long past the times when several generations of people would live and die doing the same thing without seeing any meaningful change in lifestyle and so it isn't that big of a deal if that also reflects in our own life choices.
I'm currently in a transition period, seeing if changing course from my present occupation is possible. I did the same in my 20s and 30s without difficulty, though it gets harder as you age. If I can good, but if I can't, then it's still ok. Make the best of what's available and enjoy what you have.
Life is a long series of decisions and then you're dead. What you do doesn't really matter, even if the pressing weight of it right now says otherwise. Make life choices that won't pigeonhole you and be open to opportunities you may not expect.