In Castle Age,
Fully upgraded Knight has 120 HP and 4 PA
Fully upgraded Crossbowman has 7 attack
A knight can bear 120/3 = 40 hits
In Imperial Age,
Fully upgraded Cavalier has 140 HP and 6 PA
Fully upgraded Arbalester has 10 attack
A knight can bear 140/4 = 35 hits
However, Arbalester will even has 1 more range due to Bracer. Cavalier become much more exhausting against Arbalester. If Cavalier has 1 more Pierce Armor, it can bears 140/3 = 47 hits, which is more reasonable.
Skirmisher cannot further upgrade (except Vietnamese), Skirmisher become less effective to against archers in Imperial Age. On the other hand, not all civs have fully upgraded Skirmisher. Unfully upgraded Skirmisher is not a threat to archers. Also, Skirmisher is not strong enough for offensive.
Onager may good to against archers. However, it is expensive to create, expensive to upgrade and very low fault tolerance. Once your Onager get close by a few cavalry, you lose everything. Onager maybe good in 1v1 game for against archers but become very useless in 4v4.
So in most of time, using Cavalier become the first choice to against archers. However, upgrading to Paladin is too expensive, upgrading time is too long and even the civ do not have Paladin. They can only rely on Cavalier.