You mixed the cause and the consequenses here. We produce mainly raw materials because of the free trade and capitalism.
Raw materials were practically the only thing that West purchased from USSR - they did not need any other goods (maybe with some exceptions) produced in the USSR.

And how comes that other former USSR countries (that do not have oil or gas) can maintain higher standard of living than Russia without raw material export?