If the players never go off the tracks, they'll never know if they are on a train, or if they are merely walking on the road. It's only when you try to turn the train/car in a new direction that you know what kind of situation you are in. Another analogy is that the prisoner doesn't know he's a prisoner if he can't see the walls.
The players and DMs have to have an understanding going in. If, for example, they are running a module, it is likely to have a limited number of options available to the player unless the DM creates new options. If everyone knew going in that it was going to be a module, than trying to derail the narrative in such a way where you are telling the DM "yeah, ignore that book you bought, we want to do something else" is a bit rude. If you aren't enjoying the module, it's probably better to talk to the group after the game, than have your character be disruptive.
On the other hand, a DM who understands that the plot is a bit railroady should at least try to give the PCs a few switch points. You do have to go from point A to point C, and you'll be hitting point B on the way, but there will be meaningful choices. If you have to get to the end of a dungeon to get to the BBEG, for example, it's probably not going to be a dungeon that is linear. There will be branching rooms that may loop back on themselves, which means that your path could end up with advantages. Certain choices may allow you to get into position to ambush some enemies, or you may find some useful loot in one of the earlier encounters and thus be able to use them against the rest of the dungeon, etc.
Some players will just want a linear 'dungeon delve' style adventure, and in that case they expect that they are taking a bullet train to encounters with few, if any, stops on the way. For them the meaningful choices they make are in character creation, item allocation and during the encounter. Other players will want more than that, but in the big picture, it's about having choices that are relevant. If there is only one viable choice, than choices are pretty much trivial.
In some cases, there is no choice. The BBEG is the last person they fight. In the dragon example, the PCs are going to have to fight the dragon. However, while you can take away the PCs choice to fight the dragon (with a plot justification such as, the dragon will come after the PCs at some future point, if the PCs don't go after it first) but you can still give the players options in terms of, which the knowledge that the fight is inevitable, they can try to determine the conditions of the fight. There may be multiple entrances to the dragon's lair, they can go to a location of their choosing and wait for the dragon, or call the dragon out. They could attack under the cover of night, or they could approach during the day, etc.