The Next Generation and to a lesser extent Deep Space Nine and Voyager ignores a very important dynamic of human society when the characters pronounce judgment on other cultures or past eras of earth history. What we consider to be the result of a purely moral evolution (or devolution depending on your specific viewpoint) is almost invariably the result of very concrete structural changes in society that are driven by technological advances and/or shifts in the modes of economic production. People, whether spontaneously or generationally, do not undergo some deep and ineffable moral transformation, emerging at some point with more evolved sensibilities. Instead changes in the society that they live in continuously render certain values, ideals and beliefs obsolete while replacing them with new ones. Social movements are important, but they are in many ways reactive instead of progressive, they convince either a group of elites or the general population to accept and adapt to a new reality that has already been brought about by these structural changes.
Often in Star Trek we are told about how greedy and selfish humans were in the past and how glad the main characters are that they “evolved past that”. However Federation society was made possible because of various technological and economic transformations that necessitated drastic shifts in the way their society was organised. Technological advancement translates to shifts in the modes of production from labor intensive to capital intensive. What this means is that fewer workers can produce greater levels of output of goods and services thanks to machines and computers. This can create large displacements of labor as industries evolve to require fewer workers. So far in our world these displacements are not permanent, as the overall complexity and scope of the economy increases workers are picked up by new industries especially in the service sector. But, there will come a point when automation will become so capable and inexpensive that it will make huge swaths of jobs obsolete at a rate that will far outstrip any new demand for labor. The economy will become more and more productive but require less and less workers. This will necessitate a complete revaluation of how society is organized which is far beyond the current capitalist model. At the same time the resources available to a society at the Federation’s level of technology will be immense, allowing them to easily guarantee wide access to health care, education, housing and an overall very high quality of life. Greed and the value of wealth in such a society would understandably diminish but it would be for concrete and scientifically definable reasons not because humans suddenly became better people. Even the majority of crime would disappear under these conditions because its main driving force is poverty and inequality.
So when Picard and his crew passed judgment on the humans from the 21st Century in “The
