There a a few distinct problems with the melee line.
Firstly, ranged units are too powerful. Secondly, pikes are too good compared to swords. Thirdly, the upgrade lines are all screwed up.
The latter is a smaller problem that, IMHO, I fixed in my mod, 9 ages of war, and won't go into other than pikes upgrade to muskets (because lancers are light cavalry rather than anti cavalry).
Making pikes weaker and (long)swords stronger is really a tech tree problem. Pikes are on the path to the godly education AND chivalry, while swords are on the back end of nowhere. It can probably be fixed most easily by either moving pikes to metal casting (which makes beeling education a risky gambit as there are no units on the way), or by making civil service require engineering. Gunpowder should also have another prerequisite (take your pick of any medival tech), to make longswords stick around a little longer.
The real problem, though, is the impunity of ranged units and their utter dominance at everything. I tried to do this in my mod by having light cavalry units with 5 moves, weak strength and +50% vs ranged units; but I'm still not convinced. I think they need to take damage on attacking. In the same was a planes always do, this can be rationalised as representing logistics and general wear and tear. It doesn't have to be large. Maybe just 10HP on average, independent of the target.