It's like this. There are times when the setting/terrain is already settled. If you are going into a dungeon, you may be able to skip some areas but you may have a basic path to follow. (Really, depends on the dungeon)
In some situations, like a hybrid RPG/board game like Descent or even a system like Parsely, this is really the case. You deal with things room by room for all intents and purposes.
And, you know what? That's perfectly fine. Everyone involved knows what they're getting into. You're not forced to follow the GM's script. The story isn't the railroad. The actual terrain is. Everyone has agreed to the basic narrative limitations.
The other kind of railroad is when the GM has this incredibly amazing movie in their head and the players have to follow the script. If they don't, they either don't get anything done or, worse, they get punished.
Sometimes literally. I remember being in some games where literally indestructible NPCs would show up and beat up the characters if they weren't doing the GM wanted. I've also been in games where the protagonist is clearly one of the NPCs. The PCs were just there to help out or be the audience.
And sometimes the GM didn't even realize that they were doing it.
Those were frustrating experiences for everyone involved.
I think there are a lot of lessons here and almost all of them aren't some people are bad GMs. Okay, the guy who would capriciously beat up players. We stopped gaming with him. Other folks, they weren't bad GMs. They just had some issues and, sometimes, those issues were problem players.
Really, the ultimate lesson is that telling a story that's bigger than a dungeon can be a lot of work and really needs all hands on deck.
Maybe that's why I have been becoming more and more of a fan of games that either have no GM or where the players take an active role in the greater narrative like Trollbabe or InSpectre. There is no railroad when everyone is working together to create the setting and the story.