What about PHP merits this statement? It's 2025, PHP has become modern, performant, and has good frameworks that are battle-tested and reliable. Yikes. (And this from a former PHP and now Node developer.)
there is something about "theme" code leading to complete control of servers that is fundamentally broken in every way, there is no coming back from this reputation
What do you you mean by 'theme' code?
That said: PHP isn't Wordpress. Honestly, look at a modern Symfony codebase. You'll find monads, functional programming, etc, at least that was my experience at the last PHP shop (in 2020).