In all instances against Pyhhros, it was the elephants, not the Phalanx that decided the battle.

And as far as I can recall, the Romans never lost to a Phalangite army. There is an instance of a phalanx holding a breach, but that is hardly surprising that they could do that. A phalanx is virtually unbeatable from the front and in a position where it cannot be flanked it will hold for long.