Surely, light = good and dark = bad is one of those instinctive dualisms we humans just love. And was 'invented by'/'made part of' our gods. (i.e. whether they exist or whether we have invented them.)
It would have become more important
1) When agriculuture was being figured out - i.e. Sun is great for our crops
2) In the Northern Hemisphere where a great deal of landmass has to deal with four seasons in extreme.
If you look at religions coming from near the equator - aren't Rain gods more important?