In most cities expanding the road network would cost more and provide fewer economic benefits than improving or building rail services (assuming you have a rail corridor) This is because we have been making collosal investments for decades in the road network so there generally isn't much low-hanging fruit. When Saint Louis was building light rail they basically said, in their situation, that a train line replaces four new traffic lanes and didn't have the disadvantage of dumping way more cars into already overcrowded roads in town where they don't have any more options for expanding roads.
Most countries spend far more on roads than they do rail and it has very little to do with any kind of cost-benefit analysis. It is simply that there are a lot of people with a vested interest in keeping things the same as they are now because anything else would cause change and uncertainty.
But it's not taught that way.
It's never taught that way in US schools. Ever. It's always taught as an abstraction without ever tying any of it to real life. Ever. (repetition for emphasis)
It is taught that way if you have a good teacher. All my math teachers were excellent so we got lots of practical examples. But just like any skill, there is a lot of what one of my math teachers called "crank and grind" that you have to go through to internalize the skill enough that you can then focus on applying it.
Any given program, when running, is obsolete.