It depends on your preference...
I have been focusing on JavaScript for the past 2 years, and I'm totally satisfied with my decision to switch from PHP/WordPress to JavaScript/React.Js/Next.Js.
Don't get me wrong!
I really love PHP and WordPress... I built many awesome projects with these technologies. Still, before I switched, I was constantly worrying about PHP losing ground as a preferred backend choice. This programming language is strongly specialized for server-side scripting.
And it constantly gets improved...
The thing is, many other languages like (Node.js/Python/Golang) have entered the competition in that area and are stealing market share. If you check PHP in Google Trends, you will notice it's losing popularity.
On the other hand, some people say WordPress powers nearly 40% of all websites. So there are many opportunities here: from making and optimizing websites to distributing themes and plugins.
You will never be hungry if you become a decent WordPress developer.
Moreover, as more and more people hop on the JavaScript and Python "bandwagons," there will be increased demand for PHP developers, and the salaries will start growing.
But bear in mind that not many cool projects use those technologies. You will handle a lot of legacy code, and the "wp style" of coding is uber quirky. It still needs to catch up with the PHP Standard Recommendations (PSR), any proper OOP concepts, etc.
So if you want to write modern, clean code for a rising startup... using a programming language on the crest of the wave...
Then WordPress shouldn't be your primary focus.
You should focus on JavaScript…