the ai usually builds 1 spear/city; however, in a std. war(at least on higher lvls, since no matter what, you'll be the underdog in power), you declare, sit there, wait for his sod or his attempt of sod to attack(which usually has 1 spear), you sacrifice 1 elephant against it(or not, with shock, since his sod spear ain't fortified), and then you have a field day with the rest of his invading army since it'll usually be some has(trivial), swords/axes(easy), catas(easy), maceman(rather easy - again with shock), xbows(easy).
after you killed 1-2 invading "armies", you can then go in and mow the lawn in peace; thankfully, to be not totally overpowered, they don't get cr promotion(like all mounted units). But nevertheless, they're useful in assaults too, after the usual suiciding catas.
And regarding pikes - the place where they shine is exactly before pikes; that war after you got construction. And they mean more or less you can crush any invading army, without catas. And they mean that even if you're behind in tech, you can still counter relatively easy his xbows/maces(since ai researches pikes way later then machinery/cs). And when you don't have money to promote your axes when you finally got maces, the phant still does decently in a city attack(though hardly it's strong point).
Or that you can defend a city with ease, combined with 1 axe. Basically, again, until pikes(which come ~900 or so on immortal - engineering being usually last tech the ai researches from the medieval ones, at most the one before guilds), beside sieging(where you still need the catas) there's nothing that can stand against your shock promoted phant(neither maces, nor xbows, which are in theory next era units).