Middle school teachers in Texas only require a generalist certification, a Bachelor's Degree, and completion of a teacher training program to teach core subjects. That cert (which also exists for elementary school teachers) requires only a basic understanding of each core subject area. There are certifications specific to each core subject (I have Math 4th-8th, also Math 8th-12th, along with a Master's in math), but there is no guarantee you're going to get a teacher certified in their field. As such, you get teachers who don't understand their subjects at a very deep level or how what they teach connects vertically to their student's prior education in that subject and what they'll learn in future grades.
It is a big reason why students to come to my high school classes hating math, I think, because it was confusing to them being taught by teachers who only had a moderate understanding themselves and probably taught them lots of memorization tricks and mnemonic devices instead of helping them understand their origins and why they work.