As far as I know, when you start a nonprofit there's no requirement that your nonprofit be particularly efficient or socially useful. You want to run a hospital that pays its CEO handsomely? Build a church in a town that already has plenty of churches? Organise international exchanges of frozen horse semen for a rare breed of horses? Run a college that charges $50k/year tuition? Pay for monks to just kinda hang out and vibe?
The IRS doesn't seem to require and proof those monks are measurably good for your immortal soul, or that there's widespread public support for horse semen exchanges, or that the college would be destroyed if they didn't have a football coach. The charity can just say "yeah we think the football team is, uh, good for student engagement, which serves our charitable goal" and the IRS goes along with it.
If a nonprofit college can pay a football team coach, the PHP foundation can certainly pay developers to work on PHP.
The LF has plenty of employees who help code on their various sub-foundations in one way or another. Python, NumFocus, PHP, and some others have grant programs to help pay developers to work on specific code. And Conservancy and SPI are fiscal hosts that allow their independent projects to fundraise and pay for their own work.
On the other hand, the ASF explicitly does not allow funding to pay for project development, at least not in the context of the ASF itself. The ASF does have a paid infra staff/contractors who do write code, but it's all to run infra, not for project releases.
As noted elsethread, it's all about what the charity was setup to do.
A primary reason to have a fiscal sponsor 501(c)3 -- and pay ten percent or more of income -- is that the paperwork is non-trivial each year.