This is an excellent question. But is it specific for solar? Who pay the capex for nuclear ? who pay the capex for an oil thermic plant ?
In France, in the 70's, the government have decided to build nuclear plants. It was a governmental decision, so the capex has been payed by French (taxes) people.
It seems that today governments do not any more decide for important questions.
Who pay the capex for energy production ?
Which energy do we want ?
If WE decide that WE want solar , then WE will pay for it.
If we do not have enough money to pay for capex , then we will stay in the dark.
Finance is providing a large range of solutions to loan money (to rich people, only)
All the Best
The Solar Pyramid
Ultimately, the cost of the capex will be borne by the customers. However, as you correctly note, customers are not in a position to incur such costs upfront (unless some cooperative type mechanism is used to band together the resources of the customers, which would be a slow and time-consuming process). Customarily, the capex is paid by the utility or the project company. Where does the utility or project company procure the resources? Broadly speaking (I am really making this somewhat simplistic), utility or project company finances the capex using third-party / govt debt or its own funds (customarily injected as equity) or subsidies from the govt. In short, capex is initially financed using debt or equity but ultimately paid by the customers. As you correctly point out, there is some risk that the customers may not pay. This risk is borne by the utility.
I have significantly simplified the description. There are a lot of twists and turns in the financings used. Happy to chat about them if you prefer.