Story gating happens at design stage.
At the beginning of game/story development, try and make sure your game narrative has as few ordered steps as possible. If player has to do A B C, let them do it in any order. Basically how Fallout does it, they didn't realize you could skip the water chip, but even then you could do A and then B/C as you wish.
If there has to be an ordering, like they did in Arcanum and Outer Worlds, it usually has to be the villain encounter. You probably want it to be impossible to encounter the villain without doing at least a few steps. Maybe you do this with a code or an access key, or combine some items together to face the villain.
In Arcanum, you need to get to the Void to beat the game, which entails completing a device that requires discovering and meeting multiple NPCs.
Even in a nonlinear story at certain stages, you need to block access NPCs/items/areas.
Some games are filled with essential NPCs, Cain understands the practicality of that, but personally he hates them. Essential NPCs smack the player in the face on player agency. Immortal NPCs that pop right back up after being killed are fine with Cain provided the lore makes sense but like amnesia, he's rather you only do it once.
If you end up in a situation where you really must make an NPC essential, Cain suggests making them only essential up to the point they are no longer needed (Such as the Overseer in F1, but Cain remembers midway you could fight but not kill him before the ending.) Cain also suggests holograms or magic messages depending on how your setting. You can't kill them, but they are talking to you. Another way is just make them non essential but there is always a backup way to get the information. Cain admits that even though his games do that a lot, something like a pass phrase you would normally have to do a lot of quests for being found in the journal of the NPC after being killed can feel like a shortcut. Maybe the journal just provides a note on where the NPC found the passphrase, and now the player has to go on an adventure to that location.
Please only do the gating if you have to, and you should always look hard at your story and ask if you have to. You may think the story unfolds better in a certain way, but the story is driven by the player, and they decide how it unfolds. If your RPG narrative really needs a lot of forced gated sequences, maybe you should try writing a book or movie. Sure, there are linear games out there, but Cain doesn't make them and he doesn't play a lot of them, so you are asking the wrong guy. Repeats his 3 acts vs. 27 acts discussion regarding Arcanum/Fallout and finding the perfect balance.
Ideally, the only gated sequence in a nonlinear game is perhaps the villain confrontation and all the sequences the player participated in beforehand adjust their reaction to the player.