Your dealer's diagnosis is incorrect regarding your exhaust system causing these codes as you rightly pointed out to them. Other than a DTC number, did they explain what these codes mean? Probably not, since that wouldn't have made sense to you or them.
P0171 and 174 are related to the injectors on Banks 1 & 2 reporting a lean condition, meaning they aren't supplying enough fuel. A faulty MAF can cause this, so that was a proper component to inspect. There is a procedure to diagnose an intermittent condition in the shop manual.
The Engine Control module regulates the air/fuel metering to provide the optimal combination of fuel economy, performance, and emissions output. There are two types of fuel delivery: Open and Closed Loop.
When in the Open Loop mode, the ECM disregards the oxygen sensor data for determining fuel delivery. In Closed Loop mode, the O2 sensor data is used. If the ECM determines there is ann excessively lean condition present, these two codes are flagged and the MIL light is illuminated. There's a bunch of parameters that can create this condition, but the bottom line is, if it happens again, get a second opinion from another dealer. There are ways to trap the data parameters with a Tech 2 and a tech who knows how to interpret them with the manuals.