God also commanded Abraham to kill Issac, but assuming a Divine prerogative is not for men to do. Judas was elected by the omniscient Lord who knowingly choose him as a man who would be possessed by the devil to betray Christ in fulfillment of prophecy.
In contrast, popes are elected as successors to Peter and to build the church, as men possessed by the Holy Spirit and conditionally infallible, with rejection of such being called sinful rebellion. And who cannot be deposed while they live.
Justifying election of devils based on the Lord choosing Judas is like Christ choosing Judas to fill the role of Peter, supposing he was a faithful man, and invalidating rejection of him or his successors.
Unlike the omniscient and assuredly infallible Lord, pastors are to follow Scriptural requirements for leadership, but Rome has elected men who were not even worthy to be church members. (1Cor. 5:9-13) And we are not under the type of O.T. theocracy, but one in which authenticity is not based on formal decent, but conformity of faith based on Scriptural substantiation.
Certainly God can work even with sons of Belial being in leadership, but that does not validate men knowingly electing manifestly immoral impenitent men as succeeding Peter, but invalidates them as being so while validating dissent from such presumption.
And so, evil men are selected by the Holy Spirit as instruments of God's just chastisement. What is your point?
In contrast, popes are elected as successors to Peter and to build the church
And Jesus himself warned that bad ones would be selected. (Lk 12:41-48). Again, what's your point?