It is actually historical fact complicated by the Eastern Railroads buying up the mountain passes to make sure people in the 1800 had to take the train. For example, US 22 in Cambria County Pennsylvania enters the County almost next to the Main line of the Old Pennsylvania Railroad (Now Norfolk Southern). At that point the two routes diverge, the Railroad going South to Johnstown along the Little Conemaugh River, than to Blairsville along the Conemaugh River (Where it matches back up with US 22). This way the Railroad avoid Chestnut Ridge completely, while US 22 has to go up and down the Allegheny Plateau till it comes to Chestnut Ridge.
US 22 goes directly west from Allegheny Mountain to Chestnut Ridge going along all of the ups and down of the hills made by the various creeks and runs that run through the area (the Streams all head for the Conemaugh). US 22 heads west till ti goes down Chestnut Ridge and matches up with the Main line of the old Pennsylvania Railroad.
Now why does US 22 go the way it does, first it was how the Indians travel in this part of the state. If you were walking the ups and downs were minor problem, you saved almost 10 miles by going the way of US 22 (or as the Indians called it "The Raystown Path"). When the Railroad came into existence the ups and downs would have wrecked their early steam engines, so the Railroad followed the rivers instead of bisecting them. This permitted a nice even grade unlike the ups and downs and turns of the old Raystown Path.
Now old railroads wanted as much traffic as possible, so used their power in the State Assembly to have the state given them all of the River Gaps in the Mountains their train went through. This caused two things, first, no one could build either a competing Railroad through the same valley, and Second, if someone did not want to take the train he had to go over the Mountain NOT through the Mountain Gaps.
When it came to the Raystown Path (Present day US 22) that meant when it was rebuilt to take things like cars (Starting in the 1920s), Us 22 had to stay out of the River Gaps. Furthermore since the Road had to connect with the major cities along the Railroad the new roads had to go down the hill to get to the Cities and than back up (While the Railroad stayed in the River Valleys).
When Biking in this area I have seen it over and over, small towns along the Railroad line that are connected by roads THAT CLIMB OUT OF THE RIVER VALLEY AND THAN BACK INTO IT FOR THE NEXT TOWN. Now not every Gap has this problem, for example the Conemaugh Gorge (The deepest Gorge in the Eastern US) not only has the Mainline of the Old Pennsylvania railroad going through it but two state highways (one of each side of the Conemaugh River). The problem can be seen where these two roads go (Pa 403 and Pa 56). Both connect with US 22 on top of the Plateau but are connected to each other via Pa 711 which parallels the railroad till the next town and than goes up the same Mountain side to go back down to next town on the railroad line (i.e. the old Pennsylvania Railroad did not care of some of the town connected, but that there were bottlenecks that forced you to use the train or to climb the mountain time and time again).
It was this combination that makes the Appalachians Mountains so bad, Indians paths design for walking and the Railroads cutting out any competitive transportation system.
A local College has put the County Topo maps on line for Western Pennsylvania so you can see what I mean:
http://www.rootsweb.com/~usgenweb/maps/pa/county/