Xenofon, Hellenica/Book 4/Chapter 5
"The Lacedaemonians were presently within range of the javelins.Here a man was wounded, and there another dropped, not to rise again. Each time orders were given to the attendant shield-bearers to pick up the men and bear them into Lechaeum; and these indeed were the only members of the mora who were, strictly speaking, saved. Then the polemarch ordered the ten-years-service men to charge and drive off their assailants.
15Charge, however, as they might, they took nothing by their pains--not a man could they come at within javelin range. Being heavy infantry opposed to light troops, before they could get to close quarters the enemy's word of command sounded "Retire!" whilst as soon as their own ranks fell back, scattered as they were in consequence of a charge where each man's individual speed had told, Iphicrates and his men turned right about and renewed the javelin attack, while others, running alongside, harassed their exposed flank. At the very first charge the assailants had shot down nine or ten, and, encouraged by this success, pressed on with increasing audacity.
16These attacks told so severely that the polemarch a second time gave the order (and this time for the fifteen-years-service men) to charge. The order was promptly obeyed, but on retiring they lost more men than on the first occasion, and it was not until the pick and flower of the division had succumbed [...]Again and again the monotonous tale of doing and suffering repeated itself, except that as their own ranks grew thinner and their courage ebbed, the courage of their assailants grew bolder and their numbers increased.
17In desperation they massed compactly upon the narrow slope of a hillock, distant a couple of furlongs or so from the sea, and a couple of miles perhaps from Lechaeum. Their friends in Lechaeum, perceiving them, embarked in boats and sailed round until they were immediately under the hillock. And now, in the very slough of despair, being so sorely troubled as man after man dropped dead, and unable to strike a blow, to crown their distress they saw the enemy's heavy infantry advancing. Then they took to flight; some of them threw themselves into the sea; others--a mere handful--escaped with the cavalry into Lechaeum. The death-roll, including those who fell in the second fight and the final flight, must have numbered two hundred and fifty slain, or thereabouts.
18Such is the tale of the destruction of the Lacedaemonian mora. "


so we see what a terrible threat javelins were to heavy infrantry...i suppose the idea of the Roman heavy infantry carrying some extra pila was precisely as a counter measure to the possibility of facing skirmisher opponents-that way the legionairies would at least stand a fighting chance instead of get decimated by distance... also remember that Romans must have had quite a lot of experience of such guerilla tactics subjugating the Etruscans and Italians ...figting on rough terrain against hardy mountain people who refuse to stand and fight the pilum must have proved quite a life saver ...
All in all the pilum offered Romans volatility and the ability of counter-skirmishing should the need arise ... the prospect of showering your heavy infantry opponent with some javelins before impact was just an extra treat...