Yes, this so-called "voice crossing" is one of the many things Bach did that would receive a red mark if he did it in a first-semester theory course. You'll also find moments where the alto goes above the soprano or the tenor moves below the bass.
But keep in mind that Bach wasn't writing according to rules. Rather, these rules were deduced later through a study of chorale writing by Bach and his contemporaries.
The idea is that voice crossing weakens the independence of each vocal line. So to have as "pure" voice leading as possible, we want to keep the voices distinct.
Lastly, remember that tenor lines are often written above middle C. A lot of students are afraid to write ledger lines in the tenor, and for no good reason.