Your last sentence is flat out untrue.
Not all rules are good or useful or healthy.
Being gay is no disqualification to be a good priest, regardless of any "rule".
The fact is that many in the hierarchy are gay.  If the Church actually got rid of all of its gay clergy, we would be left with very few.