In The Big Short, for example, when they wanted to short the housing market, the structure that banks set up for them was effectively an insurance policy. They had to pay a huge fee every so often, which represented the equivalent of an insurance policy payment, but in the event that the value of the market dropped below some threshold, they were entitled to a payout...which is exactly what happened.
Just because it's gambling doesn't mean it's risky or not properly risk-assessed.
I personally think it's a bigger leap to argue that Social Security is a form of insurance, but I guess that depends on your political viewpoint when it comes to whether Social Security is a kind of bank account that holds your money in escrow or if it's a government-run social program that provides a guaranteed pension. There is still a kind of gamble going on, but it's more that you're gambling on the government upholding today's promises into the future (when you retire) and if that's immoral then so are many other things in life (such as money).
In this case, the risk of never needing insurance is balanced by the gain of whatever is insured if it is lost.
One could argue that this is decreasing risk in exchange for less gain, but that’s still using a tool for balancing risk and gain, aka gambling.
Go too deep and life is gambling.
For example, when someone buys an extended warranty on a new TV they are betting that it will break before a certain date (and after the factory warranty has expired). Most customers lose that bet and wasted their money.
Insurance is literally "hedging your bets". So getting the insurance isn't the gamble, you get insurance when you're about to gamble. So it enables gambling in a way that wasn't possible before.