Some things got better. The magic variables, the killer feature which popularized PHP and also introduced the most vulnerabilities, has been gone for more than a decade. It's not nearly as easy to accidentally make a vulnerability now. WordPress is still horrific, though.
But the reason PHP is still around is simple: There's not much competition. mod_php
is still by far the most convenient way to run shared hosting. You just install the module, and people can put .php files on their website and it just works. No need to set up FastCGI, some servlet engine, reverse proxy or any of that jazz you need when using python, ruby or node.js.
Sure, if you're running your own VM somewhere, you can set all that up, but a lot of people are still on cheap, shared hosting, where all they can do is upload files via FTP. The only real scripting language which doesn't need any server software configured is PHP, so that's what those hosting providers support.