I tend to make a point of having an unit or two of something else behind the phalanx line for the express purpose of dealing with any bugger trying to wriggle between the pike units (the equivalent in city fights is two units of whatever to block buggers who try to sneak along the walls).

Which said, far as I've noticed the officers are usually way hard to kill, and most phalanxes have two to boot so they're not much of an opening. If anything, they tend to make it harder for the opponent to "wrap" around that flank as they're so tough...

Gar.