Luther invented Sola scriptura. He needed to because once he cut himself off from the church and tradition, all that was left was the scriptures. You can’t even discern the canon from Sola Scriptura. It’s extremely flawed and un historical .
That is false. First, we need to define Sola Scriptura. It means that the scriptures alone are god-breathed (θεόπνευστος) and are the sole infallible rule of faith and practice. As opposed to tradition which is not god-breathed nor infallible.
Second, Luther never wanted to leave the catholic church he wanted to reform it back to its apostolic origins. It was Rome the excommunicated Luther, not Luther leaving the church.
Thirdly, if "table of contents" is your argument know then it is perhaps the weakest argument going. Rome didn't dogmatically define the canon of scripture until 1546 at the council of Trent. The earlier councils (Rome, Carthage, Hippo etc) are regional councils and do not carry ecumenical authority according to Rome on any other subject. Yet the church was able to discern what books were inspired (God-Breathed) and which ones were not long before the fifth century councils and most certainly Trent.