Exactly the same as now: Common sense, self-protection, and the law.
Currently, people do all they can to avoid incidents, so if I do the things you mention, I will be safe to the extent that the driver sees me and can take evasive action. If what I do is detected too late to avoid a collision (such as crossing an active junction on a red light, or driving into the path of an oncoming car on a motorway) then it doesn't matter whether the driver is human or software if the event is detected too late for any response to be effective. Human or software, you're still reliant on brakes, traction, and structural stability. Those things don't miraculously improve when there's someone with faster reflexes at the wheel.
That's not to say it won't be safer when detection and response time is shorter, but it won't be so much safer as to reward stupidity.