Yes there is a proper order of authority. Does it hurt you to pray for souls who are damned? Does it hurt you not to pray for souls in purgatory? It doesn't do anything to you. So why did the Popes say it?
Are all Popes theologians? No, so if a Pope decides not to seek counsel and makes a mistake, whose fault is it?
Please stop. While not all Popes are theologian, they're more theologian that you are.
And, yes, it does hurt everyone to pray for those who died outside the Church. As for who's damned, who's in Purgatory ... we can't absolutely know. Even those who die outside the Church are presumed damned, since it's hypothetically possible they received some last minute interior illumination.
As these "non-theologian" Popes have taught, where it hurts you and everybody else is in instilling an attitude of religious indifferentism and undermining belief in the dogma that there's no salvation outside the Church.
How many times can we hear Trads say "We're praying for Queen Elizabeth." before ... people start to get the impression that there's a reasonable chance that she was saved. If some notorious public heretic can be prayed for, which implies that she could have been saved, then what does EENS mean anyway? Not much.
There's no "mistake" here, but these popes realized the danger in it and therefore banned the practice. There wasn't even any particular theological statement they were making, just that they rightly judged that such an attitude leads to religious indifferntism.
If the presumption is mistaken, and they don't get our prayers when they actually somehow made it into Purgatory, then so what? That might be the punishment God wills for having remained outside the Church for nearly their entire lives.
Just admit it ... this has absolutely nothing to do with wanting to hasten their release from Purgatory, but are really just statements that you have hope of their salvation, both to falsely console others and also as an expression of your doubt that there's no salvation outside the Church.
If I were the Pope, before I would even definitively settle the theological dispute, I would absolutely ban any and all mention of so-called "Baptism of Desire" or similar concepts among Catholics, since they serve absolutely no purpose other than to undermine the Catholic faith. If those who don't believe in it are wrong, then their non-believe would not prevent God from saving souls in this manner. If those who believe in it are wrong, they could be causing the loss of souls, since people might get complacent in thinking that Batism isn't necessary and, ironically, may therefore not desire it as ardently as would be necessary in order to be saved.