Ealgeone, that is a serious, but admittedly common misunderstanding.
Canon Law
DELICTS AGAINST RELIGION AND THE UNITY OF THE CHURCH (Cann. 1364 - 1369). Can. 1364 §1. Without prejudice to the prescript of ⇒ can. 194, §1, n. 2, an apostate from the faith, a heretic, or a schismatic incurs a latae sententiae excommunication; in addition, a cleric can be punished with the penalties mentioned ...We're not obliged to "do what the Pope says," ---the Pope, this Pope, this present Pope --- but rather to follow the Papal Magisterium. That means the authentic teaching of all the Popes as a single coherent teaching, not the teaching of a single incoherent pope. If he contradicts his predecessors, hr's outside of the Papal Magisterium and his teaching is inauthentic. We're bound to the papal consensus, as it were, which cannot contradict Sacred Scripture and Sacred Tradition.
The present, surreal situation is this: a pope contradicting all his predecessors: a pope opposing the Papal Magisterium.
We're now in the struggle of figuring out how to correct this erratic man, until God removes him from the Apostolic See.
Roman Catholicism has more rules than Carter has liver pills. The Pharisees would have loved yall.
That means the authentic teaching of all the Popes as a single coherent teaching,
Best of luck with that.
L