Don't get me wrong, if I have a villain with a stat block that makes them a good archer they attack from range. One who is an inventor of things or a manipulator of actions will try to avoid combat altogether. But this is more of a cursory 'well of course they do that' type thing as opposed to actually diving into the character and figuring out what are their strengths, and where are they vulnerable.
It's good to ponder these. To list them out. To look at each item and pick it apart to figure out what it means. Not only does it bring about a better understanding of the character, but also their approach to life - and their approach to threats.
For simplicity's sake, let's stick to a villain that wants to fight the PCs in combat. How do they go about doing that? How do they shape the battlefield? How do they prepare it? What tactics are they wary of and need special plans around? How does the battlefield get warped because of them?
Your villains don't exist in a vacuum. They should be aware of their own weaknesses, and unless hubris is among those weaknesses they'll have something in mind for how to react if a hero goes for it. A ranged attacking villain should have a way to keep people out of melee with them, or a trap set for those who do get in close on them. Perhaps it is a combination strike and distance making tool so they can get out.
We know from experience that our players consider these things. The standard party composition is the standard party composition because of how it addresses this. You have characters whose job it is to take aggro and keep the badguys in a certain position. You have characters whose job it is to take out the mooks. You have characters whose job it is to take out the big bad. You have characters whose job it is to keep everyone up and running. Every role has strengths, but more importantly it also has tools to help cover for and protect against the weaknesses of their allies.
So why don't your villains? (unless, of course, that too is among their weaknesses. Even then, better to do that deliberately than from lack of understanding how they work.)