Both sentences sounds wrong to me, because within and production seem strange in this sense.
Here is the source of the statement, which is a quote from Erik Martinson, of Svea Solar, a Swedish company. It appears that English is not Mr. Martinson's first language.
If the word within was replaced with in, then option #2 sounds a better than option #1:
Solar energy is quickly becoming dominant in the production of electrical power for new buildings in many countries.
I would instead say something like:
Solar energy is quickly gaining dominance as the primary power source for new buildings in many countries.