This kind of thing makes me so mad
Because the software engineers didn't just suddenly decide to do this...
This didn't happen by accident. They will have been given a spec, with quite specific inputs for the sensors. This would have to be written, tested and released.
The software was and is used in multiple cars and brands, each with significantly different engine performance characteristics. I would assume that the software would need to understand how to adjust each of the engines so that they reacted appropriately.
This also suggests multiple releases of software that would be delivered across businesses. Where there is co-operation across businesses senior people get involved.
So: lots of people knew. I'd be willing to bet that significant numbers of senior managers knew. Some ass, probably from marketing, probably suggested the idea because it would make the cars look more environmentally friendly. A bigger ass, probably at board level, introduced other VW businesses and car lines to the idea and the contagion spread.
This is not a developer issue, this is a management issue. Instead of making better cars they decided to cheat. It was then thought such a good idea that they did it across their car and brand range over multiple years. During this time it was thought better to lie to customers and regulators than actually make a car that could meet the emissions levels they claimed to have.
And the people who are now trying to do the whole "a few bad apples" thing know that it's not true. They just don't care.