What helped, I think, is that I was part of a small team in that big company. At peak we probably had about two dozen programmers, with 8-10 on my team. That's not much bigger than the team I'm on now in a tiny company where I also get to work end-to-end.
I disagree with specializing as you get older: there's going to be a tendency to do that, but it's the last thing you want to do. Never stop learning, never stop broadening your skillset. Sooner or later you're going to be a 40+ year old developer looking for work, and if you're a specialist you're going to be looking for a long time. As an experienced developer with a proven track record of adaptability you'll be able to justify the salary that you're going to want/need.