I'm going to suggest a possible explanation for this whole fiasco that's a little bit more in VW's favour.
The ECU is probably Bosch, and they would supply the code. I think VW asked for test and efficient modes, and Bosch obliged. Efficient mode is for normal driving, that they thought would be a bit worse in terms of emissions than the test mode but maximised MPG and performance. What they didn't know was how much worse for NOX it would be. It's possible that they didn't know. After all, to know that, you would need a machine like UV had - and VW probably don't have one. All they could do was dynamometer testing - when the ECU went into test mode.
That would explain why VW kept saying something must be wrong with the vehicle, when the road test results were so bad.
Thus, the real reason for this fiasco is good old-fashioned incompetence. It sounds more likely to me than malice. That really just seems unlikely. Maybe I still want to believe that VW's intentions were good.