There's no reason for a self-driving car to prioritise adhering to the speed limit over avoiding a collision though.
Any sufficiently advanced self-driving AI will try to avoid being rear-ended like that. Even better, when a collision is unavoidable, an AI has a much better chance at making the 'right' decision as to how to crash.