Commuter rail is not going to be $20M/km. Track repair and installing signalling and barriers is probably around $2-5M/km. Tack on the cost of stations, huge parking lots/structures for commuter rail stations and rolling stock and that's the bulk of the costs.
The real escalation comes where grade separation or modification is required. How much grade separation would be required. Where are bridges and tunnels required to be expanded? Those get expensive real fast.
A fact sheet provides some rough order of magnitude numbers:
http://www.reconnectingamerica.org/assets/Uploads/bestpractice175.pdf
The real question here is opportunity cost. We have a aroughly finite amount of money to spend. We can spend it building urban high frequency transit. Or spend on low frequency commuter rail designed to cater to sprawling exurbs. And how we spend that money and what we build will determine what kind of city we have in the future.
I, for one, will never support a vision of a sprawling mess. Ottawa is bad enough as it is. It's mostly suburban even inside the greenbelt. And, for me, every effort must be made to shift the cost of sprawl to suburban and exurban residents. If it takes them longer to get downtown and costs them more, tough. That's the trade off for real estate that's cheaper per square foot, in the burbs.
If Ottawa ever builds commuter rail, the city will go from being the large version of Mississauga that it is today to a large version of Barrie in a few years. Gross.