Why is that? Has the change in ownership resulted in the electrification costs being cheaper (or benefits being higher)? Or different benchmarks (financial/non-financial) on what gets funded versus other calls for the same money, transport or non-transport? Or something else?
IIRC UK Government did make some contribution as did the EU.
Just the political will to get it done really - the Welsh government was willing to fund the project as soon as they ownership was transferred, with the money coming from a variety of sources including the block grant the WG gets through the Barnett Formula, and was willing to make some smart compromises such as discontinuous electrification which as far as I know Network Rail were not planning at the time. While the project certainly hasn't been without it's issues I think it's plain to see as a frequent user that for the most part it's been a success, with the 756's and 398's being a massive step up from the aging Pacers and Spinters that used to operate on these lines. Plus the stations themselves have had a fair amount of TLC given to them since the transfer with new bridges, lifts, shelters and better connections to local busses. Would the electrification project happened under UK gov/Network Rail ownership? Maybe? But I'm doubtful considering they didn't think there was a good enough business case to electrify the South Wales Mainline between Cardiff and Swansea.
I mean, the fact is for the Welsh government the South Wales mainline and the Cardiff Valley Lines are
the most important and most frequently used lines in the country. For the UK government they are inevitably little more than branch lines of the Great Western. And really that's to be expected considering Network Rail manages lines that have orders of magnitude more passengers. Two different perspectives that lead to different outcomes.
This isn't really a Welsh phenomenon either - Manchester's Metrolink was created out of a series of ex-mainline lines and the improvements TfGM have made to those lines simply wouldn't have happened if they had remained with Network Rail - the Oldham Line would probably still be an unelectrified branch line running 150's at 30 min frequencies, like some neighbouring lines still are. For Greater Manchester the line was a vital connection between the north-eastern suburbs and the city centre, for the UK gov, it was again just yet another suburban branch line that managed to survive the Beeching Cuts but is not worthy of much if any investment.