I've wrestled with much of this myself. In the end, I'm grateful the Church is not perfect, for if it were, I would not be accepted as a member. Christ is perfect, but he calls on the imperfect to seek and find Him and sets lofty goals for us humans to aspire to.
Imagine a small, corrupt town with one stop light at its only intersection. The local cop is part of the good ole boy network, and if he likes you or you are one of the town bigwigs, you can run the stoplight with impunity. If you're an out-of-towner, or on the cop's s-list, you're going to get a ticket no matter how closely you adhere to the law.
Those persons in charge of administering this particular red light may be flawed, or even corrupt. This does not, however, invalidate the greater notion that controlling traffic at intersections is a good idea. Similarly, I believe what the Church teaches and holds true, even if those administering its teachings may be at times flawed, or even corrupt.
Stated perfectly.