Actually I have been wondering for a long time why trains don't do exactly what these trucks are doing. Many (most?) trains now (at least around here in the US) are deisel-electric with a deisel engine running an on-board generator to make electricity for the wheels. If you had retractable electrical things on the top of the engine to connect to overhead wires you could use grid electricity for the steep grades and other fuel demanding portions of the trip (like the first couple miles out of major rail yards where you are still getting up to speed) and then spin up the diesel as you get into the long stretches of mainline where you only need to overcome air and rolling resistance which are both minimal for a train.
In addition to this you could do regenerative breaking on these same stretches of tracks to feed power back into the grid when slowing down. Many locomotives already use electrical generators in the wheels (basically just using the motors as generators) as this avoids wear on the wheels and brakes by avoiding the older mechanical brakes. However on long down grades they still have to use the mechanical brakes since they have no way to get rid of the excess energy; the electrical generator brakes just heat up an onboard tank of water which can only take so much heating before they have to fall back to the mechanical brakes.
So basically all of the things you need to do a hybrid system like this are already onboard a modern locomotive, the only thing missing is the wires above the tracks and the thing on top of the locomotive to connect to them. The thing on top would be a very small cost to add, the wires would be a lot more expensive per mile, however you can choose which sections of rail to electrify since you are going for a hybrid approach which lets you only electrify the most beneficial parts of the rail network.
Overall I think it is a very good idea and I am surprised I have not seen it implemented or at least discussed. Maybe I am missing something but it seems like it would work well. I guess the main issue would be the large power surge to the grid from regenerative braking and the huge temporary draw when getting up to speed but it seems like this would be addressable without too much difficulty.