The car did what it was programmed to do— unfortunately, that’s not what was best for the time. I think some kind of human override is needed for this type of situation.
But this feels more like a general car problem than anything. Car infrastructure is typically not pedestrian friendly :(