TL;DR at end...
That part IS A myth. It just happened to work for your friend.
Maybe I'm misunderstanding your use of the word Myth... I'm using the Merriam-Webster definition "an unfounded or false notion."
By my reckoning if racking can, does, and has worked it ceases to be, "an unfounded or false notion."
As I stated before its not something that works in EVERY situation. Of course, its also worth noting that SHOOTING an armed assailant ALSO isn't a 100% guarantee of success. As in *MOST* things self defense related it is ENTIRELY subjective to the situation at hand. Sometimes we grab a handgun, sometimes the shotty, some times an AR or AK, they all have roles, just like different tactics (like a loud rack, or yelling, "Get out! I have a gun!") have roles.
It was also possible that he could have racked a completely empty shotgun as a bluff, with the same positive results.
I fail to see how THAT could be a bad thing... If the threat is ended, and you're safe you and the gun have done your job. The GOAL of self defense is NOT simply, to make work for the coroner. (Admittedly its not necessarily to AVOID making work either...) The goal is to end a threat, if you can do that with an empty gun, the goal is achieved.
Its also possible that the person on the other side of the door is not a drunk frat boy and upon hearing the racking unloads his own gun through the door.
Except in the case where the guy is definitely a drunk frat boy looking to hit you with a tire iron because you told him to stop blasting music and blowing his car horn at 3am.
As I said, its all situational. In my friend's case, he read the situation, called 911, told them he was armed, the drunk frat boy was armed and coming to his apartment to fight and he was in fear for his own life. The 911 operator told him that police were already on their way, but if the frat boy entered his apartment he was allowed to defend himself.
I get that you have kids and have to do what you have to do but that doesn't make "racking the pump to scare away the bad guy" a good idea
It doesn't make it a bad idea either, and its better than some of the other options.
Honestly, I can't see a single instance where having bits of metal flying around my home at thousand feet per second is a great idea.
Maybe you live somewhere significantly different than me. (I grew up north of Philly and am in Lancaster now.) I'm in a crossover suburban/rural area with neighbors all around me (except on the side of me that is a farm). I like my house, and don't know of a single place where a shotgun or bullet hole or blood or other biological matter would improve the decor. I have kids, pets, a wife, and neighbors (who I sort of get along with). I can't see a single instance where I would be ok with accidentally hitting one of them with a stray round or blast of shot.
For me, shooting is the *LAST* resort.
Add into that, the layout of my house doesn't exactly lend itself to secret ninja maneuvers and sneaking up on bad guys to snipe them with a shotgun. If there is going to be a confrontation they will know I am coming, I might as well send a notice that I'm armed, and if I draw fire at least it won't be going in the direction of my children's room, and I won't be in a clear line of sight when I do.
So yeah. For me, in my situation, based on the people I am most likely to encounter, based on the layout of my home, based on the area around where I'd be forced to shoot, (Always be aware of your target, and what is behind it.) racking or calling out, "I have a gun!" is not only a GOOD IDEA, but probably the BEST idea.
TL;DR Just because something isn't the best choice in ALL situations doesn't mean that its not the best choice in SOME situations. Saying, "Never rack as a warning" is throwing the baby out with the bath water.