It almost feels like melee units need something that would make their pathing behave the same as researching "ballistics" does for the arrows - making melee units go not where the target unit _is now_, but where it _will be_ (where it is going)
I'm not disagreeing with your point, but I think it could/should be done much simpler:
There are two problems here:
1. Melee units trail behind each other getting stuck on themselves all trying to attack the same unit.
This should be fixed and I honestly don't know why that is the case. If you click scouts on attack stance on a villager on a woodline the scouts will inevitably attack different villagers, but somehow while chasing, all knights want to attack the same xbow? There should be some change to try and attack xbows further away from them as well.
2. Archers cannot be surrounded, they will always just walk through the knights.
This is the real problem imo. Archers need to be microed A LOT to be effective, it is okay for you to have to micro knights at least to some degree to take efficient fights vs archers. I don't think knights should do surrounds by themselves, it is not a big deal to take half of your knights and micro them in front of the xbows to surround them, players should be able to make this miniscule effort themselves.
The problem here is, that this is completely pointless currently, the X-bows will just move past them and after three volleys all the knights are stuck behind each other again.
So I don't think you need a sort ballistics for knights, just a simple collision avoidance mechanic that already exists in other places in the game, that allows them to move past each other and target different units + bigger collision for enemy units, which seems to be the main thing that attack move changes.