I have been coding for a long time, over half my life (I'm thirty as I write this - or thirty-and-a-half as my daughter would say!). In that time, I've learnt a lot of different techniques, practices and styles - and I like to think, through the mistakes I've made, through other people's code I've viewed, edited, copied/pasted from Stack Overflow (we've all done it, don't lie and say you haven't!), that I've learnt a lot; that the code I write now is objectively better (I'm not going into what "better" looks like right now) than it was when I was 12, writing good old XHTML 1.1 and PHP 4!
For a long time I was very pigeon-holed, seeing myself as "a PHP developer" and restricting myself from learning other languages or using alternative stacks to the typical 'LAMP' or a close variant.
But what I've realised over the last few years or so, is that there is a lot of commonality across different languages, tech stacks and domains - enough that you really can pick up just about any web framework once you have looked at one or two in depth.
For example, if you look at Express JS vs PHP's Zend Expressive or Slim 3, you can instantly see they have a lot of similarities. On a lower level, things like DB migrations, package managers, HTTP clients, etc are pretty standard across languages - e.g. PHP's Doctrine migrations vs .NET's Entity Framework vs Node's PG migrations; or Ruby's Bundler vs PHP's Composer vs Go's Get.
The principles remain the same, so there's nothing to stop, say, a front-end dev used to writing Angular, from picking up a .NET Core app and being able to at least read the code confidently, though of course there are some barriers to actually being able to run the code, such as knowing how to build and compile the app, knowing how to actually download the relevant packages etc - but all that stuff is learnable, searchable, fairly straight forward for the most part.
I realise I'm over-generalising somewhat, and the reality is, you can't always just go straight from being an expert in one language to being an expert in another - because there are all the little idiosyncrasies and oddities of specific languages (often specific minor versions of specific languages!) and all those "gotcha"s that you don't know until you've fought with them for days at a time and all but thrown your laptop out the window!
I suppose the point I'm trying to make is this: don't limit yourself to one particular tech stack, just because that's all you know. By learning a little bit about other tech stacks, you can learn a lot about tech in general, which helps you write even better code in your primary tech stack.
You can easily get started with a new language and be more than proficient in no time at all. Start by reading other people's code, following some tutorials, maybe cloning some git repos and running them locally. Then build on that with adding your own features or building your own apps from scratch or from a template in those new languages/frameworks/whatever.
Fair warning: building optimised, secure production apps is not this straight forward - you need to really do your homework; find more experienced developers in your chosen "new" language that you can learn from - whether that's in person, at a meet up or something, or even just following them on dev.to or on Github and gleaning from their hard-learned lessons rather than having to learn them yourself, the hard way. When it comes to real users' data/money/etc you really have to protect what needs protecting, optimise what needs optimising - don't just rely on obscurity or on your hosting company's WAF to protect you. It won't.
To summarise, this is what I think I'm trying to say: if you are working on your own, I'd encourage you to find like-minded people either online or ideally in person, who can help you improve your code, keep you focussed and ultimately keep it fun! If you're working in a team, encourage each other to learn something new! If you're a front-end dev, sit in on code reviews with the back-end devs, or vice versa - and actually in some ways there doesn't really need to be a distinction. They are very different skill sets, I get that - I'm very much a back-end dev that dabbles in front-end and long may that continue! But it can only help your code to know a bit more about other areas, whatever the programming language.