Clearing up some misconceptions.
No, there is not a legal requirement for the Commonwealth to build SCR. While the Commonwealth committed to number of projects (GLX, Red-Blue, Fairmount Line, park-and-ride expansions) as part of the 1990 settlement with the Conservation Law Foundation over the Big Dig, SCR was not among them. The only agreements to build SCR have been political - not legally enforceable, and prone to the shifting political winds. The only legal requirement related to SCR is an Army Corps requirement (see below) that any use of the Stoughton route is electrified.
There were a lot of possible ways to get from Boston to Myricks (where the FR and NB branches split). From west to east:
- NEC to Attleboro, reverse move onto the Attleboro Branch (now part of the Middleboro Secondary), then NB mainline (Middleboro and New Bedford secondaries) to Myricks. All of this is active rails. A bypass over power line ROW (to avoid the reverse move) was proposed in the early 1990s.
- NEC to Mansfield, NB mainline to Myricks. The 1955 grade separation at Mansfield has rendered this route permanently unavailable.
- NEC to Stoughton, Stoughton Branch, ex-Dighton and Somerset to Taunton, NB mainline to Myricks. Would require rails relaid between Stoughton and Taunton. This is the "Stoughton route" proposed as the permanent SCR routing. Between Raynham and Taunton, there is an option to go over the Whittendon Branch, which would add more grade crossings but allow a downtown Taunton station.
- Old Colony mainline and Middleboro mainline to Braintree Highlands, then ex-D&S to Taunton. This is permanently unavailable due to development over the ROW in Randolph and Avon.
- Old Colony mainline and Middleboro mainline to Matfield, Bridgewater Branch to South Easton, ex-D&S to Taunton. Bridgewater Branch is built over and this is an inconvenient routing, so also not an option.
- Old Colony mainline and Middleboro mainline to Middleborough, Middleborough and Taunton Branch (now Middleborough Secondary) to Cotley Junction, NB mainline to Myricks. All active rail except for needing a wye at Cotley Junction. This is the "Middleboro route" currently under construction as the interim SCR routing.
- Old Colony mainline and Middleboro mainline to Middleborough, ex-Fall River Railroad to Myricks. ROW is built over and permanently unavailable.
This leaves three routes (two with variations) that are even possible to implement: Attleboro route via Attleboro (49.3 miles to Myricks) or via bypass (46.1 miles); Stoughton route via downtown Taunton (42.0 miles) or via Dean Street (40.4 miles); and the Middleborough route (46.0 miles).
All three routes have plusses and minuses. The Attleboro route would be longer, requires either a reverse move or new bypass ROW, and has a lot of grade crossings in Taunton. But it allows for a downtown Taunton station, uses largely existing ROW, and the NEC allows for speedy running. The Stoughton route requires reactivating about 15 miles of track (much of it through wetlands, which have environmental legal considerations that weren't there when it was previously used), is opposed by several towns, and either has grade crossings for a downtown Taunton station or has Dean Street a bit away from downtown. But it's the shortest route, adds service to Easton and Raynham, and has the fewest track capacity issues because it uses existing Stoughton Branch slots. The Middleborough route has severe capacity issues on the Old Colony mainline, makes Buzzards Bay/Cape Cod service more difficult to implement, takes away service at Middleborough/Lakeville station, and does not directly serve Taunton. Because of the capacity issues, it is not viable as a permanent service unless several billion dollars are spent to double-track from Boston to Braintree. But it requires the least construction cost and time to implement (without requiring a reverse move), making it the easiest way to quickly establish at least limited service.
Planning from 1990 to 2003 was disorganized; all three routes were the top contender at various. Romney halted planning due to increasing costs in 2003; it restarted in 2005. Alternatives analysis in 2009 selected Stoughton as the most viable route. The Draft EIS, prepared in 2011 by the Army Corps of Engineers, mandated electric service through Stoughton. There were a lot of questionable decisions in that EIS - such the decision to build single rather than double track, which results in clunky schedules with long meets, which led to electric service being mandated to tighten running times. Electrification added $400 million to the projected cost, when the projected service frequency did not merit electrification - certainly not compared to lines with much higher frequency. Because of these questionable decisions, and that the Army Corps had used questionable design decisions to sink other popular projects (I-384 extension in CT among them), there are rumors that the Army Corps was intentionally sinking the project. Whether that is true or not, the Stoughton route itself is not inherently flawed - merely some of the specific design decisions.
Because of continually increasing costs, the state began seeking alternate plans in 2016. In 2017, they announced the current plans: interim diesel service via Middleborough, later electric service via Stoughton. The prime consideration was "how can we get some service running as cheaply and quickly as possible, because the locals are getting ansty but we don't have a lot of cash". While there is still opposition in Stoughton, Easton, and Raynham to building the Stoughton route, it will become necessary because of capacity constraints on the Old Colony mainline. Likely, the state will make deals with the towns to add grade crossing eliminations, quiet zones, etc in exchange for them dropping their objections.
I've written a pretty complete and well-cited history of the history of the SCR project
on Wikipedia for those who desire more details.