While the technology of star trek definitely plays a role in terms of it being anti capitalist, it’s not just the tech. If today somebody invented a replicator, it wouldn’t be a full decade before its use would be locked behind a dozen different tiered paywalls on top of the instalation cost, and then eventually it going through enshitification.
The societal values and culture in star trek values life, far, far above weath and profit to the point that such concepts are basically alien. And that has to be the first step for post scarcity tech to actually be used for the purpose of post scarcity.