Re: On the other hand....
I think your view of the ECU code is much too naive. There is no piece of code that says 'if (steering_wheel_change < 5) defeat_testing_mode();'
Presumably what happened is something like... The ECU parameters were originally set up to meet the requirements. Then, during testing, someone discovered the engine was really sluggish during "high performance" manoeuvres (acceleration to overtake a lorry on a single carriageway road, for example) so a "high performance" ECU parameter mode was added, just for really short high performance needs, and so it could ignore medium-term issues like emission controls. I presume every engine does that -- the specs and tests are averages over time, not requirements that instantaneous values are never exceeded under any circumstance.
After a while, the 'high performance mode" got enabled more and more (or more variants of it got introduced), in order to improve real-life performance during road testing. All for specific short-term issues, so emission controls didn't matter. Eventually, it worked out that the engine was never actually running with the original parameters except during testing.
Of course, that doesn't mean that people didn't eventually realise what had happened, and that the effect was that in real life the car always had worse emissions than were shown in testing. But, by then. no one had the guts to stand up and say "we can't ship this -- we need to go back to the drawing board" -- maybe the future of a whole engine factory (employing everyone in a town) was tied to the success of that engine. It would have been easy to rationalise for oneself that "the out-of-spec ECU parameters were all for specific driving styles, so it is the user's driving style which is out-of-spec, not the engine", or "the California specs are truly unreasonable, so as long as we are minimising emissions, that is really OK".
People can, and must, be held responsible for allowing the resulting engine to ship. But I will not be surprised if there was no deliberate intention in advance.