Actually, most of the Masses he wrote were for Lutheran parishes in the north, which still retained the use of Latin, chant, the concept of sacrifice, and other things that Lutherans hate today. The Mass in B Minor is a different matter, as it was written for a Catholic patron, but it was not suited for actual liturgical use and was sorta discarded. To answer the question definitively, Bach was not a Catholic. At this time in history, people in what we know as Germany didn’t get around much and stayed whatever religion their prince was. Bach woulda made a great Catholic, though His St. Matthew Passion is absolutely haunting, and although I do admire the settings of the Passion by great Catholic composers, nobody can touch Bach’s setting.