The insurance company is taking your money, and investing in an index fund, and returning it to you minus their payroll and profit margin.
You can take the same money, and invest it in the index fund, and if and when you need it, sell your assets to pay for the loss. But you get to avoid paying the insurance company's employees.
You wouldn't buy insurance for the bag of rice you buy at a grocery store in case you drop it outdoors, the bag splits open and the rice is ruined. Why? Because you can easily afford buying another bag of rice.
The same reasoning applies to a car. If you have sufficient savings, you can buy yourself a new car if and when you need to. Until then, just invest the savings and reap the investment rewards, exactly like the insurance company will be doing.
But suppose you can afford to buy a new car (like many higher income professionals in the US), but you can't afford to pay for someone else's $500k to $1M medical bills (like almost everyone). Then you would forego the collision insurance for the vehicle, but still purchase the bodily injury liability and personal injury protection insurance.