I don't quite agree, there are many nuances.
1. If you don't need a level 2 unit in the map's progression (which sometimes happens), then the ballista is simply the best option. Let me explain. The accumulated ballistas on the tower are much more dangerous to the enemy than spearmen.
2. If the map requires many battles near the castle with neutrals to gather resources for building level 3 and 4 units.
P.S. But if you need to move around the map a lot with levels 1, 2, and 3 units, then there's no argument – spearmen are better.
P.S.: Take, for example, the Farmer's map. Which unit would you choose there?:)