There are also plenty of counter-examples. A quick google search of anti solar state legislation reminds us that Florida (sunny red state) had a big effort to kill rooftop solar (currently defeated IIRC but could come back), as did Kansas (very red state), as does Ohio (red and getting redder).
I don't think it is simply a red/blue left/right thing.
I think in this instance, the nature of local, small-scale solar is so disruptive to the revenue model of the odd, semi-public, semi-private patchwork of utilities that exists in the US means that many utilities will fight it. Like all bureaucracies (private or public) they reflexively try to defend their turf when it is at risk of being taken away.
In addition, yes, NIMBYism exists and due to it being a local force (often applied against wind projects more than solar), it often outweighs the more-distant global good of fighting climate change ... regardless of the political leanings of the majority of people in a given area.
A lot of case-by-case work needs to be done to keep utility companies from stifling the renewables transition. I seem to recall these folks did a lot of research and work in that regard:
RMI
Not so directly Tesla-car-related, but I would still love to hear more Tesla solar discussed here. I have been waiting a long time to see that bust out bigger than it has.