However, this is very much a case of the chicken and the egg.
It's clear that when Rodenberry wrote the first Star trek series, its sense of optimism for the future reflected the same optimism in the minds of many people. However, by writing such stories, that optimism was communicated to the people who watched it, along with people who watched or read similarly hopeful science fiction in other shows and books.
I can hardly pretend that a movement towards darker stories on screen and paper made our own future dark but I do believe that such a trend "prepares" us all to be more pessimistic about the future and thus not to be surprised by some of the things that happen, and not to try so hard to stop them.
You may consider darker fiction to be more realistic, but I think that it also hardens us to the things it portrays, and stops us getting so upset about them, eventually creating a slightly darker reality as well.
Personally I miss the optimistic visions Roddenberry and others gave us.