Yes, the church never really had a consensus on the canon. Well, then the delegates to the council of Trent felt it is better to have a doctrine on what the canon is than just to continue as it was, with different opinions and no doctrine on what is the canon. After all, some Protestants already started having a doctrine that the canon has 66 books. So the council of Trent must have felt it is advantageous for the Catholic church to have a doctrine on the canon too. Whatever doctrine they chose, whichever books they chose, for some of the books they would be in disagreement with some Church Fathers and agreement with other Church Fathers. Well, that is inevitable when you come up with a doctrine on which there had been no consensus. The Protestants who came up with the canon of 66 books of course also disagreed with many Church Fathers. But they too felt it is better to have a doctrine about it than not to have any. And with their doctrine of sola scriptura they certainly felt that it is important to have a doctrine about the extent of the canon, so people could know what books they should rely on. The Catholic church for many centuries did not feel the need for a canon doctrine, because when in doubt about some doctrine, they could rely on their holy tradition for some explanation, so they were not reliant on scripture alone. So they did not feel such a need to know whether for example 4 Esdras is inspired or not.