Took it back to Midas, resolving to get the exact DTC. Midas said it was PO141 (O2 Sensor Heater Circuit Malfunction Bank#1, Sensor#2). And they reiterated that there was No Way replacing the B-pipe could have messed with the secondary HO2S. They showed me the sensor locations while the car was up; secondary looks to be off the rear of the cat, but quite close to where the B-pipe is bolted in. I remain skeptical about the impossibility of doing damage while yanking off the pipe.
Anyway, I'm thinking of going to the dealer to have the heater circuit tested first, hoping it could still be a loose wire, rather than throw $267 + labor at a new sensor.
Oh yeah, Midas also told me the MIL will automatically come on after 50k miles if I don't replace the oxygen sensors, which don't last more than 50k miles. What?