Ideally the beneficiaries of these open source projects would help pay for them. Individually, they might have no incentive to do so; but collectively, maybe there is a way?
Something like this: several of the biggest software companies, which recognize how much they benefit from open source projects, would contribute to a fund (a separate nonprofit organization) whose purpose was to measure popularity and quality of projects those companies make use of, identify founders and key contributors, and pay for continued (or past) development of those projects. This would not replace any payment that happens now, but add to it. Even if done at a small level (say a self-imposed effective 0.1% tax on profits), it would be enough to fund hundreds of full-time developers, which is probably more than the total current direct funding of this kind of project.
Of course the selection process should be transparent and subject to improvement. If it was seen to work well, helping fund this could become a matter of pride for the funding companies, so it could become self-sustaining as part of their PR budgets. The funders could also have priority access of some kind to the developers, so it might even be directly useful for them in some ways.