Actually it DID have something to do with global warming and, more specifically, that the emphasis recently has been on reducing greenhouse gas emissions (which is directly proportional to fuel consumption for a given type of fuel) rather than reducing pollution.

Those are two different goals and sometimes fixing one works against fixing the other.  That is what VW ran into: Higher greenhouse gas emission or higher air pollution emissions.  They choose to produce more air pollution but reduce their greenhouse gas emissions EXCEPT if the car was undergoing air pollution tests.  If the car detected a test was in progress the enabled all their air pollution reduction tools to pass the test at the expense of higher greenhouse gas emissions during that test.