You are confusing the description of how a character is portrayed (i.e. ACTING in a villainous manner) with their proper label as a
literary FUNCTION,.. which has ZERO to do with what a character ACTS like.
Step away from the adjective, and embrace the NOUN.
Must we all be literary critics when we speak of Star Trek?
Your definition of
any force in opposition between the hero and his/her goal is so nebulous that broken elevators might be "villains." A friend who stops the hero from going into a booby-trapped room filled with cash is arguably villain.
How do we determine the villain function when there is no clear-cut goal or when goals in the story change?
And what if there is no clear protagonist? How is the protagonist marked (if character does not matter, we've erased the most straightforward marker)?
Kirk is ostensibly the hero of the story, but this notion is challenged very early. He demands natural resources on the basis of need and threatens to use force (very different from the Kirk who was attempting to negotiate with Halkans in Mirror Mirror). Kirk develops a sudden and irrational attachment to a robot and attempts to "liberate" her on the basis of that attachment. Kirk behaves so badly that at the end of the episode Spock has to give him a Vulcan roofie so he can forget the affair.
The hero of the story isn't the hero. The narrative is not a heroic, but tragic. Spock even stands to the side like a Greek Chorus warning Kirk not to be an idiot, but he takes no heed and tells him to shut up because he is fighting over a woman.
Now, if we are absolutely limited to speaking of heroes in terms of functions, we can never learn the lesson that heroes are not always the hero, because someone like you will correct us
"Yes, he IS, it's his literary function and character has nothing to do with it."
On the other hand, there is truth to your perspective. We could not have learned the lesson that the "hero is not the hero" unless we had successfully marked Kirk, at least initially, as the protagonist of the piece. There can be no reversal if the hero is not marked in the text. We need to have access to both senses for literature to fully function as a way of "saying something" and producing "aesthetic experience."
Your structural notion of villain-function is useful (even if it needs specification) and it should not be entirely purged in favor of a character-based definition.
In ordinary language, however, when we speak of villains we are not merely speaking of functions, but also making a judgment about the character of those who are placed under that label.
If we're being fair, I think we have to allow for speaking of villains in both registers of function and character.
When someone muses that Flynt wasn't really a villain, they are not contesting his literary function. They are operating under one understanding of the term. Moreover, they are demonstrating that they understood what the message of that episode was. As a writer, it would be more gratifying to find that one's reader "got the message", rather than correctly identified formal roles of the characters. If we get the message we might conclude that there is no single villain in this Trek story. And this recognition might cause us to ask if there is something more to be had than a simple and limiting definition of terms like hero and villain. We might demand more complicated definitions or at least note the inadequacy of the definitions we have. And if we can do so with justification, we will not simply have to default to your preferred definition as regulating our discussion of the thread title and the OP.