That's simply not true. They work very hard to understand and control the risks they take. But there is an entire field of reinsurance[1], which is insurance for insurance companies against the times they get it wrong, such as major disasters. And even then I suspect you'd find a big enough disaster would break the reinsurance companies too.
Which is why reinsurance companies take out so called "super cat" (super catastrophe) insurance. Some of the world's bigger super cat insurers are Berkshire Hathaway subsidiaries; National Indemnity is probably the best known one.
[1] https://en.wikipedia.org/wiki/Reinsurance