Isn't machine code also microarchitecture agnostic? I thought that the definition of a microarchitecture was a particular implementation of an ISA that externally conformed to the ISA in the same way as any other microarchitecture.
Mostly, yeah. But microarchitectures do sometimes add new instruction set extensions, like how Intel's Skylake added AVX-512. Bitcode can be re-lowered to the new extended ISA to use these instructions (assuming you don't need to target earlier uarchs). Machine code, not as easily (and I don't think anyone really tries, though I'd be interested to learn if someone does).
Latency of instructions, number of ALUs and FPUs and available special functions differ from micro architecture to micro architecture. This makes the compiler behave differently in instruction selection when you select different micro architectures.
Of course, implementation details are different between microarchitectures - that's the definition, after all.
However, "agnostic" usually means that behavior doesn't vary. Performance is orthogonal to behavior in this case. I definitely don't expect code optimized for Haswell to be as fast on a Broadwell as code optimized for Broadwell, but I do at least expect it to run.