Bach's chorales were functional music for the Lutheran church, and to the extent that they form any sort of "rules" in music theory, it comes from the fact that they have been used to teach harmony for a long time (since at least the 1940s, as evidenced by this article). The reason for that isn't so much that they're prime examples of Western common-practice harmony, but rather that they have a homogeneous texture that's easy to use in classrooms, because they're easy for one person to play at the piano or for students to sing.
Recent music theory pedagogy has largely been moving away from the reliance on Bach chorales to teach harmony, especially as music theory has taken a broader perspective on what music we should be studying anyway. Studying the Bach chorales is just fine if you want to know about how Bach used harmony, but there's a whole lot of music in the world, and there's no meaningful sense in which Bach's music intrinsically defines a set of rules any more than Mozart's or Clara Schumann's or AC/DC's or Meredith Monk's defines a set of rules.