For example, Trent stated:
For which cause, this council has thought good, that the Symbol of faith which the holy Roman Church makes use of,–as being that principle wherein all who profess the faith of Christ necessarily agree, and that firm and alone foundation against which the gates of hell shall never prevail,–be expressed in the very same words in which it is read in all the churches.(Trent, 3rd Session, Decree on Justification)
That looks like an interpretation of Matthew 16:18, in which the rock foundation is the profession of faith. And it’s not just one of those foundations, but the “alone” foundation.
Then Vatican I comes along and makes the statement:
In order, then, that(Vatican I, 4th Session, 1st Dogmatic Constitution on the Church of Christ, Prologue)
the episcopal office should be one and undivided and that, by the union of the clergy, the whole multitude of believers should be held together in the unity of
faith and communion, he set blessed Peter over the rest of the apostles and
instituted in him the permanent principle of both unities and their visible foundation. Upon the strength of this foundation was to be built the eternal temple, and the church whose topmost part reaches heaven was to rise upon the firmness of this foundation. And since the gates of hell trying, if they can, to overthrow the church, make their assault with a hatred that increases day by day against its divinely laid foundation, we judge it necessary, with the approbation of the sacred council, and for the protection, defense and growth of the catholic flock,
to propound the doctrine concerning the institution, permanence and nature of the sacred and apostolic primacy, upon which the strength and coherence of the whole church depends.
This gift of truth and never-failing faith was therefore divinely conferred on Peter and his successors in this See so that they might discharge their exalted office for the salvation of all, and so that the whole flock of Christ might be kept away by them from the poisonous food of error and be nourished with the sustenance of heavenly doctrine. Thus the tendency to schism is removed and the whole Church is preserved in unity, and, resting on its foundation, can stand firm against the gates of hell.(Vatican I, 4th Session, 1st Dogmatic Constitution on the Church of Christ, Chapter 4)
These also look like an interpretation of Matthew 16:18 — one in which the rock foundation is Peter.
Pick a council, pick an interpretation, but both views cannot be right. If both cannot be right, then both cannot be infallible.