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.
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).
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.
Also, if Amish are allowed to opt out of social security, why can't Libertarians?
The Social Security opt-out is only possible for members of certain groups, most of which were special carve-outs added when Social Security was first implemented[1]. One of those carve-outs is for individuals which are members of a religious group that has existed continuously since 1950 and have a religious objection to Social Security (those requirements only really match a handful of religions who lobbied for this right during the introduction of Social Security). However, anyone who wants to be excluded from Social Security must have never received Social Security benefits or made Social Security contributions and must be a member of some kind of pension scheme. Some police officers and some teachers are also excluded from Social Security due to different carve-outs but still qualify because those police officers' and teachers' unions have pension funds.
Libertarians don't have any carve-outs (nor do any other political group for that matter).
> How is a "pension scheme" different from "social security", in any way that matters?
There really isn't any difference (at least from the "is it gambling" angle). The main difference is that the pension schemes aren't government-run (unlike Social Security). It was a historical compromise (the groups lobbying against Social Security happened to be okay with being able to run their own pension schemes) which probably looks fairly strange in retrospect, but that's the way it is today.
[1]: https://en.wikipedia.org/wiki/Social_Security_(United_States...