If a player picks a character option that’s not suitable for all adventures or adventure sites, I make sure to let them know when they take that option. They should know that their choices may not be optimal in all possible adventuring sites.
Then, I make sure there are opportunities to involve their choices in other situations. For example, I ran a classic modules campaign in 3e. We were playing through the Scourge of the Slavelords adventures where there isn’t a lot of room for mounted combat in the various slaver fortresses. One player, who loves riding, made a fighter with mounted combat feats. So, I found ways to incorporate her preferences by holding a tournament in Ulek, a place the PCs managed to lead a bunch of slave refugees they had rescued. I also gave her a stone horse to use for some of the later Against the Giant modules where there was room to ride. She couldn’t use her mounted specialty everywhere without contriving some really silly stuff, but we made sure the option was open where it made sense.
One notable way of handling these things, if you want to make mounted combat more dungeon-friendly, is to encourage them to pick appropriate characters and mounts - small riders, medium mounts like halflings on dogs, goblins on wolves. Or for a lot of underdark campaigns, Drow or deep gnomes on lizards.