Teachers need to decide which goals are most important for them and for the students they typically teach. For instance, if you ordinarily teach a freshman-level survey course that introduces students to the field, giving students practice in the conventions of writing for that field is generally inappropriate. Rather, you would probably want to give students opportunities to write about the new, foundational concepts they're being introduced to so that you can be sure they are learning the fundamental ideas they will need to take other courses in your discipline.
Teachers thinking about assigning writing in their courses also need to consider just how much time they'll have to review or respond to student writing. Assigning a 20-page term paper in a course with 200 students is unrealistic because teachers just don't have time to read and respond to such lengthy student writing.