Furthermore, my impression (though I cannot find a citation to back this up) was that many if not most of Bach's compositions were produced by taking elements of popular culture and trying to produce from them something people would find meaningful on the next Sunday. Consider the Passion Chorale, which Bach used in (among other things) the Christmas Cantata and the St. Matthew Passion. The tune was originally composed 50 or 100 years earlier by Hans Leo Hassler for a song whose title was something like "my heart is beguiled by a pretty maid"; the most common words ("O Haupt voll Blut und Wunden") are from a German translation by Paul Gerhardt of a mediaeval Latin hymn.
All of this is not to deny or even to downplay Bach's genius. He simply, as derefr says, took popular inputs and did amazing, wonderful things.