In the cases presented, the car in front reacted in time to make it safe for that car, but they probably had a less obstructed view. It's not the car in front's responsibility for the car behind to follow at a safe distance.
It is your responsibility as a driver to maintain a safe distance behind the car you are following. The car in front of you should be able to spontaneously turn into a brick wall, and you should have enough space to stop before hitting it
Why is it unrealistic, besides the fact that you're following too close behind? If your line-of-sight is shorter than your braking distance, you are driving wrong.
Something more realistic then. Drive far enough behind the vehicle in front of you so that you can stop before falling down the same sinkhole/broken bridge/earthquake damaged overpass they just fell into.
Math seems to work out if you keep a 3 second distance to the car in front of you.
Google shows two-second rule when looking for "safe following distance" - I was taught 3 seconds and it seems more reasonable assuming slightly over a second reaction time.
This has happened to me several times over 35 years of driving, driving along at freeway speed and the car in front of me swerves at the last second to avoid a stationary object either car or mattress or very recently dropped material from a truck in the road. Usually there is a clue because you can most of the time you can see how other cars other than the one right in front of you is reacting unless the car ahead of you is much taller or has super dark tinted windows. I wonder how accurate LIDAR is through the rear window and front windshield of the car ahead of you.
I cannot vote this comment up enough. There needs to be a clear view of the obstruction in order for a person or an autopilot to see it in time. This is why you get a huge long string of cones easing people out of a lane before a road work obstruction. Similarly, warning signs should be placed before a stopped vehicle obstruction - there are quite a few countries in the world where not carrying warning signs for this purpose all the time is illegal.