it's possible that could happen, from what I've seen people will start running if they see you pulling your gun out regardless if they get the jump on you or not.
"from what I've seen" lolwut
I wouldn't even assume they actually notice you pulling a gun.
If they do notice it on you ahead of time and approach then they will probably make sure they're confident they can control their hand before zooming on you.
Big factors are shit like awareness of surroundings. Like for example
1) "is there space to step backward"
2) "is there anything on the ground I could trip on while stepping backward"
A retreat to create space could be a good idea to keep a pepperspray/gun out of control of an attacker while you prep.
OTOH might not be the best idea against someone with a knife becaus ethey could prep a powerful lunge, in that case closing distance once you control the arm could be better.
I think most of us (me included) have no instinct at all for this though and would benefit from some kind of grappling drills.
My best instinct would be shit like "flail at the knife like a windmill and hope it gets stuck in my forearm instead of my chest".
I could still bleed out from an arm artery but it's probably slightly less likely than bleeding out from a chest artery"
Also maybe I should try body-checking the inside of a guy's elbow with my throat because that sorta guarantees his knife is too far from my head/neck to hit it. He could reach around to stab me in back but maybe it hits a rib or shoulderblade instead of my soft front, I dunno