I could have come into a job and say "okay, I know back end, let me focus on that" but instead I spent a day installing a shitty data pipeline that more or less took us through the next 4 years of data analytical needs for almost no cost. Etc.
It is just how it is. I even read a post on HN about a decade ago about how a guy was hire #1, was instrumental in the growth of a company, and when it was purchased was pushed out because they didn't need a generalist anymore, they needed a specialist. And so he decided to drop the generalist role and focus entirely on one technical aspect to the benefit of his career.
So while I agree with Tim, I also have to say, as someone in the thick of it, there's no good way out. Unless you want to keep working for Seed / Series A startups, fingers crossed they sell or you won't make that okay payoff.