Not sure why it is downvoted as this is true. That said it is more to do with shared hosts culture choosing PHP than PHP itself. (They tend to support Ruby and Node but not as well)
Keep a shared host secure, PHP or something else was not an easy task, most people installed unsecure versions or misconfigure something.
Also it was a pain to support PHP versions after EOL (yes, money), and multiple versions .
When you extrapolate that to modern tech, you could create a shared hoster with a configured reverse proxy and per customer docker images.
But that is so much expensive to build, operate and bill than an apache. And looks very close to AWS and friends.
Not with CGI.