Haru - both of those examples are taken from the novel themselves and that advice was intended for setting up your NPC's intended actions, not what actually happens. Things go wrong for NPC's too, plans go awry, they make fumbles and you should try to make this as natural feeling as possible.
As I stressed, the important thing is to build tension in the scene and to add to the challenge of the scene without simply adding to the stats of the NPC. Obviously instant fatalities in any RPG are a form of railroading and should be avoided.
First example, a goon shooting someone in the back is a perfect example. The goon in question in the books stood no chance in a standup fight with the player and since the NPC has asked around and been told the player is a bad-ass who regularly kicks the butts of anyone who gets in their way, the npc opts to start conflict with a backstab (well back shot) since he knew in a direct confrontation things would likely go badly for him.
Now as a GM, it's up to you to provide multiple avenues for the players to act. So in that scenario, first there are perception rolls to see if they recognise the shooter (who works for a well known underworld figure making that a possibility). Then you have the NPC attempting to sneak up on the player (giving them an appropriate penalty for carrying a non-concealable weapon like a shotgun. Then as a bonus chance see how quickly the player gets into the car giving themselves partial cover. Obviously in the book the dice rolls went badly for the character who is still fumbling for their keys when the npc gets close enough to begin their attack.
But then you have the NPC penalised for not having gotten enough information about the player and they unload the shotgun directly into the armored longcoat of the PC instead of aiming for a headshot. Then combat begins. The NPC's has gained a small advantage by managing to inflict a minor wound on the player but ultimately the players are able to recover from the scenario.
By simply modifying the NPC's behaviour you've increased the tension of scene as well as the difficulty of the encounter but by no means has it made the encounter un-winnable.
Compare that to say a scene that begins with "You see 2 men walk into the street. They are holding shotguns and looking your way with hostility gleaming from their eyes. Roll initiative. What do you do?" By making the way you begin combat routine, you make gameplay stale. If you can add an element of panic to the players responses in a combat scene you will get a more involved roleplaying. There's a reason Jim has Harry or his companions getting shot at the start of an scene in so many of his novels... it's more dramatic that way.
-----------------------
The same with using snipers. Don't have them immediately one-shot a PC. That gonna lead to a terrible story... unless a player has specifically asked you to do that to them as a dramatic exit or the like anyway.
One of my best games ever, I had planned with a Player well in advance that we would kill his character at a dramatic point in the storyline without telling the other players and I introduced his replacement character as an NPC well before this point.
The other players shock and rage at the villain responsible for their dramatic death made the next few sessions especially enjoyable as the Players thought I was a massive jerk until we let them in on the secret after they finally took the villain down.
Before you do a scene like that watch pretty much any Hollywood film ever that has the protagonist attacked by snipers. Typically the first shot narrowly misses (you decide if you want to use some trope like coffee getting shot or an innocent bystander walking in front of the protagonist at just the right time), it lightly wounds one of the characters or the character is warned at the last second. Then the protagonist dives for cover and tries to come up with a plan.
The distance between them and their attacker is what adds to the challenge here (plus the surprise). What do they do? Do they try to escape or try to close ground with their assailant? Perhaps they sit still and call for backup to help them out. Any approach the players attempt has a stream of smaller challenges for the players to navigate.
If they choose to run they need to come up with an escape plan, keep under cover as well as determine if there is more than one assailant. If they choose to fight they need to work out where the bad guys are and find some way of striking back. If they call for backup from other PC's maybe you start switching the action back and forth between two locations. If they call for backup from NPC's maybe have them have to act to help the NPC's aid them (locate the enemy / blind them by reflecting light off some glass etc).
Maybe you add some side challenges as well, like rescuing an innocent bystander who has been injured by the sniper and providing medical care to them, or having to run back through sniper fire to grab the briefcase a player dropped when the shooting started or whatever.
All these challenges add to the difficulty of the encounter, call for a wider range of skill use making it more likely all the characters will feel useful, and can be done with fairly low powered enemies. The same enemy with a weapon doing similar damage in a straight up fight is not going to be as interesting, but that's why it's important to add extra challenges that aren't directly stat derived to all encounters.