Since when should writing be a form of punishment?

This happens every so often: I’ll be talking to other teachers about some discipline issue they experienced during the day where they had to dole out some kind of punishment. More times than I want to remember, they’ll say something like, “So I made him write an essay about…”
Then I’ll think to myself: Great. Here I am trying to teach kids in my middle school language arts class to love writing, to need writing, and to see its value in their lives, and this teacher is using it as a punishment.
And no, this doesn’t happen frequently, but it still happens often enough.
Thankfully, the National Council of Teachers of English took a formal position on the issue as long ago as 1984. Its “Resolution on Condemning the Use of Writing as Punishment” warns that the practice “defeats the purposes of instruction in this important life skill and causes students to dislike an activity necessary to their intellectual development and career success.”
In other words, punishing students with writing assignments—whether those assignments are paragraphs, full essays, or even merely copying sentences over and over a la Bart Simpson—creates students who associate writing with drudgery.
However, writing should not be a punishment.
Writing should be seen as a diversion where students can express themselves and their ideas in creative and unique ways.
Writing should be seen as the literary art that it is, no matter if students are writing an essay for class, a novel for Wattpad, a screenplay for a contest, or even an entry in their own journal.
Writing should be seen as an intensely personal endeavor that can serve them well as they continue through life.
So punishing a student with a writing assignment does not sit well with me. After all, does punishing a student with the task of writing an essay actually curb the unwanted behavior? Or does it just compound the notion that writing is something to avoid, something no one would ever want or need to do?
When should the act of writing—and, in a broader sense, the act of learning (since writing is one way we learn)—be a form of punishment?
Never.