I believe it lasted as long as it did because the Church had to be ready to institute God's ideal before He would overturn it through revelation (that He was "slow to hear their cries" because of the hardness of their hearts and the incorrect traditions of their fathers - Alma 11:24). I might be wrong about most of that, but I am confident in saying that racism played a central role in how the ban evolved. I'm fine with that, since I simply think it was unavoidable - a trade-off, if you will, that was part of locating the Restoration in
In a nutshell, I believe the Restoration of the Gospel did NOT remove totally the "incorrect traditions of their fathers" from affecting the early Church leaders and members. They brought prejudices and biases into their membership (just as we still do), and they didn't have the luxury of over a hundred years of growth and clarification. The theology and doctrine were still new and overwhelming and evolving as they started to separate out the clinging false from the new true. I believe the Priesthood ban was perhaps the best (worst?) example of this pruning process - a literal fulfillment of the last pruning described in Jacob 5.
I don't believe that pruning process is complete yet, and I don't know what other issues will be part of that process, but I do think I still see through my glass darkly enough that I'm not going to stake my testimony on anything remaining exactly as I understand it now. We've seen enough change over the last 180 years that I'm not convinced I know anything well enough to speak authoritatively about most things of eternity.