And in any case, when the guy sees a javelin heading for his face he'll try to duck his head or at least angle it so his helmet gets in the way. I've read people, regardless of the period or place, actually react curiously similarly when under fire; they always sort of crouch or lean forwards, like they were facing against a stiff wind.

In any case, I rather doubt the phalangites were quite drilled to stand ramrod straight under fire.