Taxation of energy is a big revenue stream for the governments. What happens when people start putting independent energy sources to power themselves and it causes significant revenue drop ? Would the government tax them for putting up solar on their property ? Couple this with electrification of transportation and you have another taxation source (fossil fuels) losing revenue. This would lead to a disruption in the social power dynamics in a country.
Yes, energy companies can invest in these too, but why would I buy from them if I have my own generation ?