I'm a Scala developer working on fairly typical, distributed systems / web apps. I have no plans to stop Scala since I love it but any JVM language would suit me. I'm also into system design / architecture in the distributed system, "reactive" architecture domain. Those are the systems I tend to work on, massive web apps consisting of many microservices.
I'm always learning and trying to be on the edge of my comfort zone which is key I think. If I'm not messing with Scala then I'll be learning more about Kafka, Docker, SQL / Mongo, Terraform, AWS and a bit of Linux.
I'm far from a master in any of these things and I don't think I'll master many which is fine. I know enough to do my job and I keep on learning but the breadth of what I have to know is too broad to master it all. My true passion is programming, particularly functional, and I would love to master that for myself as much as anything. I guess you have to chose where to go deep and where to go for breadth. You can't master it all!
Scala is an absolutely awesome language, one that I love. I've had some of the best times building distributed systems with Scala + Akka and frankly would have loved to lean into that ecosystem and become a master of it.
Unfortunately, the market for that specialty is relatively small when compared to the broader software engineering market. I worried about specializing in a language that was niche. Compare it to, for example, the need for React, React Native, or even simply Java.
I have chosen to be very flexible in my career and learn many languages, across many domains. This, I think, is the source of some of my feelings of burnout in my 30s. It's just a never ending grind. When I do find a domain that I really love, like firmware, or Scala... I'm forced with the difficult decision of depth v.s. breadth and breadth always seems like the "safe" route, especially if you're willing to jump between frontend or backend and whatever is the flavor of the week as far as frameworks go.
I've heard horror stories of engineers who dug into their tech stack and never really kept pace with the industry, only to find themselves disposable, and inflexible, in their 40s and 50s. Whether or not those anecdotes are worth worrying about is certainly up for debate. I tend to be a worrier so, it's no surprise I've chosen the safe route.
As for specific languages, as long as you're aware of a couple of paradigms, eg OO and FP, I figure it's not that hard to switch. Once you've mastered one or two languages you can generally be productive in another relatively quickly. We don't necessarily hire Scala devs for example, just engineers we think we can train up.
I'm lucky in that the Scala job market is hot in London but I'm fully prepared for that to change one day. I'd probably target Kotlin or Java jobs if that happened but also open to anything interesting job-wise that will have me. I have my tech preferences but if I need to switch, and someone will allow me to learn on the job, then fine!
Sure, some devs become managers but there are only so many managerial jobs. Some also drop out but not in vast numbers. From my own experience, I see quite a few of devs my age (40) and older. For the most part we're senior engineers, some are managers. I don't know anyone who's left the profession. Just my anecdotal evidence but I do feel this phenomenon is overstated.