the economy of Soviet Union was already shit for quite some time, and some have argued that it is the forceful investments into the military and space race, at the expense of the citizens consumption and other productive activities (e.g. producing cars, educating people better, etc.), which led to the USSR collapse. So it is rather the collapse of the Russian economy which led to the USSR entering a tailspin than the other way around, and unreasonably high level of space investments was one of the key accelerator to that tailspin.