The deductible is also intended to take care of moral hazard. You still have some skin in the game. Insurance companies are wise to never shoulder all of the risk.
That would only fix it if the risk was being taken with no benefit. If the person has a $5000 deductible and could spend $300 to prevent a 5% chance at $50,000 in damage, now they won't, because their expected value of the loss has gone from -$2500 to -$250, which is now better for them than paying the prevention cost.
It also makes incentives weird, e.g. with a $5000 deductible you'd prefer a 5% chance at $50,000 in damage (expected value -$250) over a 10% chance at $5000 in damage (expected value -$500).
Which is why the expected value of the loss without insurance is $2500.
You have a 5% chance of losing $50,000 and a 95% chance of losing nothing. If you have insurance with a $5000 deductible, that becomes a 5% chance of losing $5000 and and a 95% of losing nothing. Expected value is the sum over all events of (probability of event) times (cost of event). 5% times $5000 is $250, 95% times $0 is $0, total with insurance is $250 instead of $2500. So you risk $50,000 over $300 at 5% probability because $45,000 of the risk is on the insurance company.