I kind of went through the same process. But luckily, I was able to "specialize" pretty early on. I was motivated to program due to the desire I had for games. So I studied how to make games. I learned to code, and worked towards it. This is a really great article showing the reality of how programmers and computer scientists are "made". With an intense interest in programming and learning all the nooks and crannies of it. And then some shoddy code is written. And we pretty much teach ourselves. We find out that work sucks (like everyone else does), and then we figure out how to make that better. Because that's what programmers do. We figure out how to fix things and make them better.
Specialization can be extremely lucrative and rewarding if what you are specializing is in demand and you love the craft you're working in. However, the risk is the specialization you've chosen slips out of demand and your specialized skill becomes obsolete. It also depends what your purpose for learning programming. As a product manager, being a generalist and knowing enough to break stuff is very valuable and will continue to be valuable because it marries the market demand with the skills needed to accomplish what's required.
To the dude that wrote about programming. Is it programming that sucks, or programming to someone else's plan and persnickety demands? Programming something that would help someone for whom you care, or for a cause you care about seems worthwhile. I know a dude, my brother actually, that learned programming language when he was in his thirties for fun. He was interested in doing something creative and positive in the world. He and a few friends started this thing called Hubski. From what he says, he really enjoys the programming he does. That is, in between the hours that he spends bringing home the bacon at a job, like any, that can be sucky at times. Don't give up at what you're good at. Find those primes in your spare time possibly.
I found a pretty substantial discussion of this on Hacker News: https://news.ycombinator.com/item?id=6468448
I'd argue it depends on where you work and what you work with. He makes a good point that if you want to be on the forefront, Linux is where to be. The Kernel group is doing some awesome shit. Security is another place. I'm going to go into some ethical hacking soon for a potential job out here, and there's a whole world that opens up. The military and research labs started a lot of it, and they and their contractors are still doing a lot of it.