Tolerances and build quality weren't the problem with the butterfly keyboard. It was just a fundamentally flawed design that was not durable enough for real world use.
I can't imagine that it didn't stand up to very extensive lab testing, before getting approved for mass production across Apple's laptops. It would be very interesting to hear some inside accounts about what went wrong there. I wouldn't at all be surprised to learn that the mass-produced parts didn't quite measure up to the prototypes, whether because of less consistent materials, part manufacturing defects, slightly off assembly, ....
To be fair to the designers, the height budget they were working with is an extremely hard target to hit for a part that gets as much physical abuse as a keyboard. I was pretty impressed with how passable the keyboard was for typing on, given the height constraint. (However, I was not impressed with the dropped actuations, double actuations, inconsistent key feel after a few months use, broken keycap that my 1-year-old keeps removing and hiding around the house, etc. Overall it ended up being a catastrophically bad design based on poor reliability.)
The biggest problem at company scale was that they couldn't revert to something like their previous keyboard in a shorter time frame. The lesson is to avoid completely locking the whole rest of the system design around a brand new untested part for which there is no alternative. It would have been better to test the new keyboard design in a context like an external iPad keyboard where if it turned out to be a dud there would be an obvious path to an alternative, and customers wouldn't be left with a broken $2000 machine.
I think their lab testing did not include dusty home, outdoor and food crumb simulations that the real world has, probably fairly clean factories with high amounts of ventilation sucking out all the dust with robot fingers doing fatigue tests.
What was even worse was the usual Apple cycle of deny there's an issue, begrudgingly acknowledge that it "may" be an issue, and then tout a new, improved version that fixed things and resolved the problem (and then didn't - how many iterations of the butterfly are we on now?).
They got through at least 3 versions of the butterfly design, and kept using it from early 2015 through late 2019, before finally switching to a new (thinner than pre-2015, but still substantially thicker than the butterfly switch) rubber dome scissor design.
It would have been much better if they had figured out how to cut their losses and revert the keyboards in 2016 or early 2017, even though that would have taken a substantial redesign of the rest of the laptop internals.
Selling 4.5 years of laptops with keyboards that broke easily under ordinary use was a huge black eye for the company.
I was well aware of scissor keyboards. I owned a 16" MBP.
Given that Apple is still selling, or has only just stopped selling models with the latest butterfly keyboard - the issue may have solution, but hasn't gone away. Millions of laptops have faulty keyboards which, when they break, will be replaced with another faulty keyboard. That's an unresolved issue.