Forget about it. That is a simple problem.  Drive a Tesla. It keeps track of ten times the interactions you describe. And it never rests and is always on the lookout. Even with autopilot deactivated it would jump in and react if there was a vehicle in your path. It uses the concept of drivable space. For actual information into how they solve problems like the one above check out their last investor video where they describe the hardware, software and how the AI learns based on all the miles the fleet has driven.  It is remarkable and as a software developer I get it. To think a human can track as many possible outcomes and decision points is just silly. It will only keep getting better. 
I totally get that the automakers who can’t do this - yet - as well as Tesla claim it is difficult. It is. But to think everyone needs to be in an autonomous car is silly. There are still pedestrians and bikes as well as weather and tons of natural hazards.  The car will still be millions of calculations ahead in all these scenarios than a person. 
Drove 10 hours back on i70 yesterday. At night the wind from the north made staying on the road quite difficult for everyone around me. Without autopilot it would have been a long night keeping the car going in its lane. Instead I just turned the system on and it allowed me to pay extra attention to those other hazards. The car fought the wind and turns effortlessly. Most impressive at 85 mph.  The car is especially useful in the fog when a human would not even see a car. The Tesla even sees when a car ahead in traffic is stopped long before a human would be able to see it with the other car in the way. 
Expect close to a ten fold increase in safety according to the insurance institute. That is due to active safety which is always on standby. It also makes you a better driver, if you don’t use your turn signal all the time you will soon get tired of the system reminding you - love that.