In road traffic, it is rare that a collision situation can be identified as "unavoidable" 5 seconds before it happens. If there's 5 seconds, you have enough time to stop from any legal road speed except on slipperiness, in which case, you're going too fast to begin with, and at a more appropriate speed, 5 seconds is still enough time to stop.
Developing situations can sometimes be identified 5 seconds out ... but that's while actions can still be taken to prevent the bad outcome.
It's more common that (let's say) another driver fails to signal a left turn and makes the left turn in front of an oncoming driver who has not enough time to stop and no escape route available, maybe a second before impact ... it has happened to me. I used that second-or-so to cut speed from 60 km/h (legal) to probably 30-ish by the time of impact. I knew I was going to hit the other car, but I didn't know that until they started their unsignalled turn directly in front of me a second or so before impact.
If there's not enough time to react then the collision is 100% the fault of the one that violates the right of way. If there's enough time for the other vehicle to take avoidance action without difficulty and it fails to do so, then a portion of the real-world responsibility is on them, even if the legal fault remains with the one who did the right-of-way violation.
If a self-driving system fails to identify a tractor-trailer across its path multiple seconds before impact and it nevertheless leads to a collision ... that's on the self-driving system for failing to identify and react properly.