The bit that isn't rules-lawyered away is that the risk is shared. For the deal to be compliant with the religious law, the lender must accept the same risk as the borrower, equally.
So I guess in this case if the house burns down and the insurance only pays 50% of the agreed value then the lender only receives 50% of their agreed repayment.
Isn’t there still risk for a lender in a typical interest-bearing loan? That the borrower will default?