My suggestion would be to give swords/longswords a unique promotion which makes them heal some damage proportional to damage they inflicted when attacking cities. Another option could be that they deal double damage to city garrisons. Would make them really good at sieging cities. They also need to be quite cheaper than knights (no horses = lower cost).
Right now the problem for them is that they can't attack & pillage or attack & pillage which makes them quite vulnerable when attacking. They also loose to everything (knights, crossbows, ranged ships, fortified cities) other than pikeman in their era. Even pikeman can perform decent against them if they are fortifed or they are on a fort/citadel.
Making knights more powerful than other units of there era just make them more abusable in the hands of the human player. Buffing longswords would also help AI more as they generally have plenty of them if they got the resources. Human players generally just skip longswords because knights are just better on offensive. When you need to meatshield fodder, pikemen with proper promotions & fort also work pretty well & can defend quite well against mounted units.
The point that knights shouldn't be compared to longswords because they require different resources is moot. Unless the map screwed you over pretty badly or you decided to play ultra tall kind of game, you can easily get decent amount of horses & iron. Even 4-6 iron & 4-6 horses can be enough for a decent army. Use 4 knights as offensive force, build trebuchets/crossbows to support them & have pikemen to provide most defensive roles. Maybe get longsword medic but that would be optional.
At least that is how I feel about the medieval combat balance right now. Maybe longswords could have more use in long drawn fights with trenches dug on both sides & nobody willing to take the risk. But in most cases a group of knights can easily wreck havoc on enemies. If you can't conquer them, no problem just pillage their tiles & cut their city connections. Longswords can't do that effectively, they can't attack knights head on & they are quite vulnerable when attacking cities, making them pretty useless for me other than acting as meatshields in some situations.