Discussions on the forum seem to imply that units charged on the side/rear cannot attack back and don't get phalanx hits. I don't see that in the rules (base or regiment) but we've been playing that way and it seems to work. Is this still a rule or something that got removed from an older version? Do wavering units get Phalanx?
Yes, units attacked in the flank/rear can not fight back.
To answer your second question, I think they'd still benefit from Phalanx. Also don't forget, only the first two rows contribute to the number of Phalanx rolls. That seams to get overlooked a lot.
I've housed ruled that units flanked can fight back but only the models in base contact (on average only 2-4 models) with the enemy and do not trigger phalanx. This gives a chance to fight back but at a significant disadvantage. I found it strange that they wouldn't defend themselfs. Units attacked in the rear still can't fight back as the unit was taken by total surprise.