I found this topic very troubling as a Mormon and researched it more than almost anyone else in the world, hoping that at some point it would make sense. That didn't happen. The church's history/beliefs with race (including but not limited to the Priesthood) are abysmal, full stop, and in my opinion there simply is no adequate explanation for why an organization led by God screwed up so badly on such a basic issue as the equality of God's children. And no, it's not true that "everyone was just as racist back then." Many people opposed slavery and supported the civil rights movement while this church did the opposite. Recognizing that its stance on race was never inspired helped me to recognize that its stances on women and LGBT+ individuals aren't either.
This is an example of steering the boat. the mormon god is not racist and would never have kept men out of the priesthood based on their race. The leadership found that integration was inevitable, so they reversed the ban.