My understanding of diesel runaway was that it's caused entirely by lubricating oil finding its way into the combustion chamber air charge, usually but not always through a failed oil seal in a turbocharger.
Most modern engines (by which I mean 1990s onwards), especially fuel injected ones, operate an "overrun cut-off" mode to save fuel and enhance engine braking, where if you're off the throttle and the RPM is above a certain level (typically mid-1000s), they don't deliberately inject any fuel into the cylinder or air charge, only resuming injection (or carburetion) when the speed falls below that threshold in order to prevent a stall (some particularly twitchy models, such as hard-boosted small diesels, are actually set up to start injecting a little bit, at slightly higher revs, if the engine speed is falling rapidly, as an "anti-stall" tactic, but that still requires rpms in the generally 2000-or-less range, and for them to be falling, not rising).
Therefore no change would need to be made to how they operate in order to implement your idea; all being well, it's what they already do by default. If you're not touching the throttle, and the revs begin to rise, the system will first progressively reduce the fuel being injected in order to try and regulate the idle back down to normal speed and, failing that, will cut it off entirely once it's above the overrun threshold in order to implement engine braking. If that's not enough, because combustible fuel is being added from another source, well ... unless the engine has some other specific anti-runaway system installed (e.g. a solenoid activated flap that will catastrophically strangle the air supply), or the driver is able to take sufficiently swift and brutal action to forcibly stall it whilst the anomalous fuel flow is still quite small (as I once had to do) ... you're stuffed. The ECU can't do anything.
On top of which, as engine computers generally don't do a great deal to integrate the information from the ABS wheel sensors and/or the gearbox (and particularly not the clutch), beyond the level of controlling the speedo needle and activating the ABS/ESP where needed or turning on the reversing light, or cutting fly-by-wire throttle power if wheelspin is detected, the ECU pretty much has no way of determining whether an uncommanded rise in engine speed is due to anomalous runaway, a bit too much lingering easy-start spray introduced on a freezing morning, or the engine being mechanically overdriven by the roadwheels due to a steep downgrade or use of downshifting to act as an engine brake. It'd certainly have difficulty knowing what's what in the case I experienced where the runaway kicked in whilst I was doing 80mph along an undulating motorway, and the rise could have been due to just coasting downhill, or riding the clutch whilst downshifting...
((incidentally, maybe it's since become a thing in everyday passenger-car diesel engines, but having any kind of flap, throttle valve or restriction in the intake was very definitely NOT the case in any that I've owned; part of the efficiency of the system in yer typical small TDi is based around the absence of such things, with engine power and speed being reliant entirely on the amount of fuel injected just prior to TDC on the compression stroke. If there's a safety shutdown flap, then it should be stowed safely outside of the usual airflow until it's actually needed, only then slamming closed. I suppose it'd be likely most useful, reliable, and simple to implement if it just opened when you turned on the ignition, and closed when you turned it off...?))