You are raising an important point that goes back to the story of Joseph in the Bible. In years of plenty, society should store away some of the surplus so it will be able to handle the years of disaster. It is not clear if socialist societies are any better at this than capitalist ones. They don't seem to be. I don't recall anything about Marx or Engels discussing the need to put capital away for a rainy day. It is notable that modern insurance mechanisms arose in capitalist societies. But many countries with widely varying systems did not do a stellar job of risk management when it comes to Covid-19.