Yes that sounds like an exhaust leak. Your rich exhaust mixture is swapping places with the outside air, so your O2 reads lean, it dumps more fuel and you smell gas.
I had an exhaust leak on my manifold due to broken bolts but it never caused a code or driving issues. Your leak must be much more severe.
Carbon deposit build up in the intake runners and valves.
Turbo cars are more prone to gunking. When the runners start to get carbon, it affects to the ecu's target afr. The ecu then adjsuts fuel to compensate for the altered air flow.
With that extra fuel the deposits break off, and it instantly sets a lean or rich code.
Simple checks to also look over.
Exhaust leak pre 1st o2 sensor.
I had the P0171 code also. It turned out to be a silicone coupler on my Injen was cracked. The one that connects the intake to the turbo. It was difficult to tell it had a crack until I removed it and squeezed the coupling. You might want to check that as most checks for boost leaks don't check the intake.