It is very easy to get yourself into this situation as a software engineer. The other engineers don't ask you to cheat. This happens:
1. Some engineer figures out that since "x" isn't working, they need a "test bypass" function to keep the program going forward. By itself, this is really common. The engine might be running on a test stand, and most of the car is missing. As such, the software has to have a "test bypass" function to deal with the missing gas peddle, brakes, transmission, etc.
2. The program keeps moving along, using the "test bypass" function.
3. The entire car is assembled, and the "test bypass" function is still in use, because no one ever figured out how to make the meet the emission test.
4. The "design freeze" is made, as the car is ready for production. However, the test code is still in place.
5. The car still doesn't pass the emission test, but it is ready for production and sale.
6. Massive scandal/recall ensues