From my experience (working 100% remotely for some years), I'd say that the sweet point lies in relatively "exotic" stacks, like Scala, Erlang, maybe even Rust.
It's not that there are more remote jobs in Scala than in Javascript. However, people who hire Scala developers seem to accept that when you need a top Scala team, you have to bring people from all over the world, i.e. they are fully committed to building a great fully remote team, not bringing remote developers as an afterthought (in general, you wouldn't want to take a role of remote engineer in a mostly non-remote team, especially if you are one of the first ones).
And Python/Javascript developers are dime a dozen (maybe not, they are still expensive, but much more numerous, and usually there isn't a problem to hire locally).
I would definitely agree that you best option is to pick a stack that is popular enough to have a bit of traction but one where knowledgeable practitioners are rare enough that a company would consider finding someone who knows that stack compensate for the perceived downsides of a remote worker. I would probably replace Erlang with Elixir/Phoenix on that list, you are likely to find more open positions and the latter will imply web work that is more amenable to a remote coder.
We actually decided on remote early on as a way to expand our potential talent pool, when it became a key part of getting our first hire on-board. We've recently made the decision to start doing our major work in Rust after it had a strong showing building an important internal tool and prototyping a small service in it, and our mounting frustration with the current stack (plus some other issues that made it a good time to decide if we wanted to switch). A remote hiring policy has been key to confidence in that decision; we've yet to fully put that into practice with actual Rust hires, but I'd be much more wary with a talent pool restricted to just the local area (Austin, in this case).
What about legacy systems that were once popular but aren't anymore, like PHP? I know there's a lot of wordpress development demand out there and fewer and fewer skilled devs who are willing to learn and/or work with PHP.
I totally agree. I'm working right now as a remote Scala engineer, and while I was job hunting, I saw more remote positions for Scala/Spark than any other stack. (At least within the world of data engineering)
It's not that there are more remote jobs in Scala than in Javascript. However, people who hire Scala developers seem to accept that when you need a top Scala team, you have to bring people from all over the world, i.e. they are fully committed to building a great fully remote team, not bringing remote developers as an afterthought (in general, you wouldn't want to take a role of remote engineer in a mostly non-remote team, especially if you are one of the first ones).
And Python/Javascript developers are dime a dozen (maybe not, they are still expensive, but much more numerous, and usually there isn't a problem to hire locally).