Bach contemplations - Riemenschneider #205
Passages like this make Bach an endless source of musical contemplation. In a discussion with Stan Kleppinger some time yesteryear, he formulated a wondrous analogue for such seeming eccentricity. In the first years of theory, says Dr. Klepp, when we give you the part writing "rules", it is like showing you how to juggle with three objects. When we look to Bach, it's like going to the circus and seeing a master juggling with 7 objects. Indeed.
In particular, consider the tenor line in m. 2-3. I would mark this wrong on a student paper without hesitation. The aerial acrobatics continue in m.3 beat 4 to m. 4 beat 1. This passage from m. 3 to 4 is another case - relatively uncommon, but it does happen - where IV is used as an embellishment of V. This example is particularly "Kinks-ish" because the embellishment is on the strong beat.
It should be noted that this is a chorale-ified version of the Te Deum. Whenever Bach is harmonizing melodies that are pre-tonal, they do tend to be adventurous trips to the Procrustean bed. Dangerous stuff from someone that is clearly working out his own harmonic salvation with fear and trembling.