I can program anything, bring me your dead and I will raise it.
Specializing, that's called a job. Work is work and they have a stack you gotta use, better or worse.
No one can take the hacker out of the hacker though.
My resume in terms of languages basically goes back in time, where I'm "expert" of what I use every day, but what I haven't used for a while I just put "good".
How do you sell yourself as a specialist to a company with a stack? Simple, "I don't know X but I'm keen to learn. I'm sure I can scale up to it". If they pass on you, it wasn't meant to be. As a job, your job is to return higher value than your cost. If you do that within a team, you're a net positive. Whether it's by teaching what you know as an expert, of coming up and scaling up to help wherever you can.
Either way, there are very few stacks that are permanent enough that you could be an expert in the matter for decades. Things simply move too fast.
So get behind any shiny new stack that you fancy and become a subject expert, it might pay the bills in 5 years. If not, you probably learnt transferable skills. At the end of the day, no matter the language, stack, team, we're just all trying to get the computer to do X.