There are two ways of approaching this. The first would be to make only the carrier liable but the freight rates would vary according to the dangerous nature of the product and everyone would have that mandatory insurance.
The second would be to make the carrier directly liable—ultimately it is their insurer who will have to pay compensation—and to give them a special subrogatory recourse right against the owner who would have shared liability for the goods in question. Regardless of the approach, I think that it would be logical to make the owner of a dangerous good more responsible than the owner of chickens or grains, which is how it used to be in rail transportation.
The point is to share the risk, whether that is done directly with a regime by which the owner pays a share of the insurance premium, or a liability regime for the owner who will have to subsequently respond.
What is important is that it not be the victims who have to figure out who to prosecute and who to ask compensation of. The carrier or the insurer must provide automatic payment.