It really is apples (pedophilia) and oranges (homosexuality). One is illegal and immoral, the other is just illegal (in most countries).
It is really rotten fruit either way -both activities are immoral and evil.
Homosexuality (the disordered condition -all causes unknown -in some cases not chosen) is not legal or illegal -it is a disordered condition subjectively claimed and not objectively measured -as such, the disordered condition that predisposes one toward homosexual activities can not be legislated for or against. Regardless, the Church teaches that those that suffer the disordered condition merit just discrimination; e.g. banned from military service, banned from Boy Scout leadership, and in this case banned from ordination...
Homosexual activities (always a choice), on the other hand although disordered and always intrinsically evil are legal in some locals -in the US, the evil of sodomy was legalized by judicial fiat recently...