Only income derived through labor should be truly safe, as labor is useful to civilization, unlike gambling, often with winnings from previous gambling gained using loaded market influence dice and marked insider information cards.
AI and Automation is going to destroy these human labor=value claims of classical Marxism even further. The point is you can’t choose not to live in a capitalist society as if you’re an ostrich burying your head in the sand. I invest my retirement and portion of my savings in market index funds because keeping it in a bank will lose value over time due to inflation. Keeping the money I have earned through my labor as cash or in a savings account is pretty much guaranteed to lose value as inflation occurs. There is risk in the market, but I’d hardly call that type of investment gambling.
There is a reality we live in, and regardless of political beliefs or opinions on labor and capital, you are in capitalism, your participate in capitalism whether you like it or not, so might as well protect yourself and future by playing the game of capitalism to some degree.
Marx enjoyed the fruits of bourgeois society and participating in fox hunts arranged by Engels. I don’t think it’s a problem to have some irony in fighting the good fight, while investing in a 401k.