It's a valid question and one each of us should consider at the onset of our diving experience and not "at the moment", if that should come along. For those of us who have had to make that call, it's wrenching even after having considered the consequences in advance.
For me, when I take a person as my dive partner, whether it's a friend, family or "insta buddy", there is only a thin margin in what I feel my response will be. The emotional response might be worlds apart, but my actions would most likely be much the same. When I take a buddy, he/she instantly becomes part of my 'family', and I'll treat them as such in an emergency.
Could I let go? I had to once, if only briefly. (While towing a stricken diver along a line I became entangled. I had to make a very fast decision to let him go and disengage myself from the line or keep him with me. I let him go, got untangled and then caught him again, but I still wrestle with guilt because he didn't make it.)
Like many who have responded, my answer might be affected by factors other than diving. I was a firefighter and first responder for 27 years and I've had to make the same decisions many times. (Enter an engulfed house to look for victims? Easy call. Stand up to your ankles in gasoline while trying to extricate a gravely injured driver while electrical sparks pop over your head? That one's tougher.) I was also a certified lifeguard for a long time, and one has to make similar decisions in that venue, too.
The bottom line is that we all should consider the ramifications of our decisions well before they pop up. Good thread!