It is hard to imagine that a large number of reasonable tech and business people would do it that blatantly for so long. After all it isn't Mafia nor government nor banks. I wonder whether it was done as some temporary "fix" back then, just to meet schedule/KPIs/etc., which just naturally became a "feature".
The way I see it, they probably did it somewhat incrementally. To some degree, they've ALWAYS programmed the ECUs "to the test", because isn't that basically what the authorities want? A system that meets standards X, Y, and Z, as verified by a test of X, Y, and Z? What got them into trouble was the fact that ECUs became more and more sophisticated, allowing them to gradually isolate X, Y, and Z into ever-shrinking "islands" of compliance. It was tolerated for so long that both engineering and management probably became accustomed to cheating the test to some degree, so when the standards became even more stringent, they basically saw nothing wrong with creating a special "clean" ECU profile narrowly tailored to the specific parameters of the test procedure. Granted, they knew they were cheating, but I think when you're inside the corporate bubble and everyone's operating on the premise that cheating has always been tolerated on the test, it becomes harder to be the guy that says "this is too much".
Reminds about that GPU performance tests story of Nvidia if I remember correctly.