Mellivora capensis, what your story demonstrates is that your attackers were just not prepared for someone to resist in the face of guns. They expected you to freeze and then comply. To see you react and try to find a weapon of your own was as much a surprise to them as it was to you.
Furthermore, when they realized what you were doing, they were unprepared to actually shoot you. Or maybe they didn’t want to damage your car. Because if they had been real violent heartless thugs, they would have shot you through the car window rather than trying to open the door to get to you.
But you are correct, pistols at arm’s reach puts the gun in position to be defended against. The flipside is that accuracy of the shooter means too much distance and they become less effective as well. Thus the conundrum: do I stand off and shoot and hope I’m a good enough shot and he doesn’t evade, or do I get close and hope he doesn’t grab the weapon?
As for self defense and martial arts, I’m going to go against some of what has been said here. Most people are not training self defense to get in the octagon or go five rounds against Chuck Liddell. Most people are not going to have to withstand Mike Tyson wailing on them. While conditioning and being able to take a blow can be useful, especially from a brawl type situation, most of the time the intent of a self defense reaction is a rapid overwhelming response to disable the attacker enough to escape.
Yes, it is valuable to train at full speed. Yes, you need to condition so muscle memory takes over. But there is advantage to slow speed walk throughs prior to high speed moves. There is advantage to light contact drills learning focus, combined with full contact strikes. But full contact strikes can be done against pads and mitts rather than each other. Most of us have regular jobs, regular lives. Going to work with a black eye or broken nose is not high on the list of things that help your career. Having broken ribs is not pleasant if your job is data entry at a computer, nevermind a physical job.
Realize there is a difference between the three aspects of martial arts - the Art, the Sport, and the Self Defense. The Art is for expression and can help train form and concentration and such. The Sport part helps train movement and working with an opponent and finding targets and finding targets, etc. But some of the techniques used in the sport may not be the most effective in a self-defense setting.
Self defense training should emphasize situational awareness and avoidance. But it should also train you on moves and techniques that do not require a lot of precision to be effective, that work independent of the size of the attacker and defender, and that allow the defender to rapidly take control long enough to get away.
Also, while physical fitness is laudable and encouraged, not everybody is going to be Bruce Lee, Jackie Chan, Chuck Norris, whoever. Some of us are going to be a little out of shape. Some of us are never going to have the flexibility to do the splits, or break a board above our heads. It’s a fact that many of us have other things in our lives and cannot dedicate 4 hours a day to training. If what you want is Self Defense training, you should find a program that works with you as you are to develop your best ability, not expecting you to become Chuck Liddell or Royce Gracie.
Realize that your self defense training does not make you a badass. The intent is to provide you with tools to use in an emergency.