One of the more painful things that I came across regularly was that we often had multiple great people go through the full interview process for a role, but could only hire one. Often 2-3 candidates could have done the job brilliantly, but we could only choose one. In that case, it tends to be really subtle things that shift the decision. (And this is where Google's Unconscious Bias training is vitally important - https://www.gv.com/lib/unconscious-bias-at-work)
It sounds like that situation may very well be the case here: lots of expense (both time/effort and $) and a long series of interviews, with a "no" at the end. (And in my experience those "no's" are often blunt, no matter how awesome a candidate is, for cover-your-ass/legal reasons.)