But how did they know which books? If we grant that the early church was competent in declaring which books were Scripture then it was equally competent in declaring what was Christian doctrine. And if the church in the first centuries was competent to do this then it is so today. Without the declaration of the church we would not know what were the books of the Bible in the first place.
You lost me with that last part. What "is so" today - the declarations of what is canon or doctrine, or the maintained competency allowing the modern church to make future declarations?
The early scene and for the first three centuries after the death of the last Apostle had five hubs of bishoprics: Alexandria, Rome, Antioch, Constantinople, and Jerusalem. The first great church council was held in Jerusalem (Acts 15). Until the schism into two legs, the meetings of the Bishoprics were conducted in Greek not Latin.
IIRC, it was not until pope Innocent iii (1198 - 1216) that even the Eastern leg assented to the leadership of the Roman Bishopric.