I just want to know why are the bad guys always melee players.
I can tell you. But it is a difficult matter, which will lead to a wall of text, but you asked for it, so don't complain.
In cRPG we have three basic classes (="metaclasses"): Infantry, Ranged and Cavalry.
On battle mode, we are fighting as teams, which means there are other players fighting with us against a similar number of enemies. This already changes quite a lot, compared to a pure 1vs.1 situation. Your teammates have an impact on your gameplay.
For example, cavalry helps each other out by distracting the enemy. Sometimes, when I spawned late with my pikeman, I got killed by cavalry. Usually a pike makes you invulnerable towards melee cavalry, but when there are three or more of them, you can't keep track of all of them, and sooner or later one of them will see and use the chance to backstab you. This happens quite automatically, because as cavalry you are pressing W constantly and are riding around, clicking whenever there is an opportunity to attack.
Archers, on the other hand, usually tend to choose good shooting positions, and somehow instinctively stick together. As a map usually has only few good shooting positions, you find a lot of archers there. The thing with archers is, that they support each other exponentially. Which means that every archer more supports all the other archers equally. The more archers there are already, the more archers the additional archer will support, which means the overall support delivered by every additional archer becomes bigger and bigger = exponential. You can see it very well in strategy games. If you reach a certain amount of Space Marines, they can kill an endless amount of charging Zerg.
Now let's see infantry. Infantry can support each other only to a very limited extend. You can be supported in melee only by three or four teammates at the most, given that two of them are pikemen, for example. Additional infantrymen won't help you, as they don't have that radius of action to support you. And in difference to ranged and cavalry, the differences within the infantry meta-class are quite drastic! There are shieldmen, hoplites, pikemen, twohanders and crushthrough infantry, to name only the most important classes. compared to the cavalry and ranged metaclasses their gameplay differs quite radically. While all cavalry and all ranged share the same strengthes and weaknesses, infantry depends much more on teamplay than other classes. You need a shieldman to be protected from ranged, and you need a pikeman to be protected from cavalry. And then you need a two hander or something like that to dish out some damage.
So basically we can say, that infantry has the POTENTIAL to not be countered by anything, but counter everything themselves, but on the other hand it has the REQUIREMENT of tactics and teamplay to do so, which the other metaclasses do not have, at least not to that extend. Which means, that playing infantry always requires more brain (overview, planning, tactics, discipline, etc.) than playing the other classes.
Next to that basic difference of infantry compared to cav and ranged, there is another aspect, which is linked somehow: infantry is the "reacting" class, while cavalry and archers are rather "acting" classes. This has to do with the rather barely measurable aspect of "flexibility" of the different classes. I would say the main element of that flexibility is the choice of your target. Due to the high speed of their horses and the long range of their bows/crossbows, cavalry and archers are able to pick their targets, and usually you pick those which are easy ones. Infantry doesn't have the chance to pick easy cavalry or archer targets very often. It happens only when the cavalry or archers are very unaware, which is definitely less likely than being surprised by a rider or hit by an arrow in the middle of the battlefield. Another aspect is being able to evade enemy attacks, which infantry can't do much about, except of always facing attacking cavalry or dodging/blocking incoming projectiles (with a shield). Or hiding at a safe spot and being basically useless and experiencing a rather boring game, limited to watching the (usually ugly) textures of some rock, tree or ruins.
Edit: also the time you actually fight matters. When the round starts, cavalry spurs their horses and shortly after is already stabbing at targets, until they get downed, if at all. Archers start, run a rather short distance until they find a good position and start shooting. They shoot until they need to displace, and even while displacing they can shoot and keep on fighting, at least if they have a little bit foresight and move in time (so they don't need to actually run away). Infantry gameplay consists mainly of running after targets and checking the surroundings, while the actual melee fights don't occupy that much of their playtime. At least less compared to cavalry and archers.
This leads to the situation where infantry is actually all the time in danger and needs awareness all the time, whereas cavalry and archers can very well estimate when they are rather safe and when not. This leads to the impression of infantry, being somehow the "cannonfodder" or the "fool" on the battlefield. They are limited to the choice of targets which AGREE to be attacked by infantry, which was especially obvious before the kiting nerf. Together with the inability of infantry, to attack and kill certain classes (especially ranged cavalry), which unfortnately is the goal of the game, this leads to regular frustration for infantry players.
All those problems which I mentioned were more or less only adressed by balance tweaks, usually in form of stat nerfs for ranged and cavalry classes. But stats don't change anything on the problems I mentioned above, cavalry can still pick their targets, archers are still able to shoot over distance, and infantry is still limited to reacting instead of acting.
If you ask me for a solution, I can only repeat the solution I came up with long time ago: change battle more to conquest mode! Infantry would have a new task which would be much better accomplishable, because it is easier for infantry to conquer and hold terrain instead of catching and killing a horse archer. Next to this it would give infantry some kind of common focus, instead of that blurry goal of killing all enemies, leading to infantry scattering all over the place in the desperate attempt to turn their reacting into acting.
If something is unclear, please ask by rephrasing what you understood, instead of flaming me instantly and wasting a lot of time to write something I probably agree with. In any case I can say that I did not want to give any evaluation about any class, the skill needed to play it or their justification in the game. I just wanted to point out the differences in gameplay for those classes.