Also keep in mind that part of what makes the utopia work, canonically, is that humans have somehow evolved beyond their vices and bigotry and the fully voluntarist socialist society it portrays just works because everyone is perfectly fine working just for the betterment of humankind or personal intellectual gratification.
In other words it only works because it ignores basic human nature. Which is one reason why Star Trek's utopia isn't really tractable. The others being the technology that completely ignores the laws of physics. Free energy, warp drives and magic boxes that grant wishes.
If people want a science fiction "utopia" I'd say look at Babylon 5. It certainly has its flaws but its Utopia isn't real (because they never are,) it's an ideal that people are always struggling towards.
Apparently there's enough capitalism for mining colonies and merchant traders. "No!! If you shut down the mine we'll go bankrupt!!"
In-universe there was a brutal nuclear war that killed a large number of people. And then after the war they developed technology that got rid of a lot of material scarcity and disease.
I find it somewhat plausible that this could actually lead to something like the show depicts. There is precedent for sweeping moral changes in human history. For example, large parts of the world now find practices like torture, slavery, and collective punishment to be repugnant. Those practices still happen to some extent, but they're not viewed as being just normal like they generally were seen back in the day.
Another example is how Europe and Japan after WW2 genuinely became more pacifistic. Not just as a pretense to fool outsiders, but as a genuine change in how the inhabitants see things.