It is controversial whether pilum heads were intended to bend or not. But let's leave that to one side for now. If a unit of Romans all threw their Pila, it stands to reason that a few should be lost or damaged, so the problem of replacing this equipment exists regardless.
Adrian Goldsworthy's The Complete Roman Army argues that Roman units threw their pila as a group at point blank range immediately before the meeting of the lines. This means that after a battle which included close range fighting there would typically be a number of men missing this piece of equipment. This could be predicted and it must be assumed that the well organized military systems of the Romans had some method of addressing the problem.
However, I don't think we know exactly what solution they chose. Moreover, since the Romans have hundreds of years of military history, and their military systems ranged from a citizen militia to a professional army, it's probably likely that they had more than one approach to the problem. Firstly, Roman artwork exists that shows Legionnaires marching with two pila. Goldsworthy states that it's unlikely that two could be effectively carried in battle, so presumably the second pilum would be left with the baggage as a pool for soldiers who could not recover an intact pilum after an engagement. Secondly, the Roman army typically contained soldiers with blacksmithing, carpentry, and other skills so they would be able to make basic repairs to equipment and could have fixed damaged pila. Lastly, the overall solution to supplying the army with equipment changed over the centuries, Roman citizen's militia largely brought their own equipment, the legions of the late republic probably purchased it from contractors, and the legions of the empire used state run enterprises to produce equipment. Presumably this has implications for systems of replacement equipment as well.
Of course, any system of providing replacement equipment must have broken down at points in the long history of the Roman army, so from time to time Roman Legions must have included soldiers doing without pila, using captured equipment, using rocks and other field expedients and so forth.
It is debatable whether the pila was actually intended to bend, or whether it bent due to other situations (such as improper removal of a pila stuck in an object). However, we did know that the Romans used lighter javelins that were more likely to bend and also used heavier javelins (eg. different types of pila) that were less likely to bend. For example, Polybius states that the light, 3-foot javelins used by velite skirmishers had thin points (hammered thin) that were more likely to bend on impact. However, he contrasts this against the 6-7 foot pila, and states that the pila had a stronger design and how well the iron shank and points were firmly attached the the shaft:"Each is fitted with a barbed iron head of the same length as the haft. This they attach so securely to the haft, carrying the attachment halfway up the latter and fixing it with numerous rivets, that in action the iron will break sooner than become detached, although its thickness at the bottom where it comes in contact with the wood is a finger's breadth and a half; such great care do they take about attaching it firmly."
Scholars such as MC Bishop originally thought that the pila was supposed to bend on impact in his older works. However, in his more recent work, he revised his opinions in light of new evidence to say that the pila was probably not intended to bend on impact. According to his more recent works, such his “Pilum: The Roman Heavy Javelin,” many if not most Roman javelins are actually very sturdy and don’t bend on impact (with exceptions such as Marius’ wooden peg pila or the Velite’s very thin javelins). He states that most pila that do get bent are bent from people improperly trying to remove a pila stuck in another object by applying to much lateral force while trying to wiggle it out. The pila is perfectly capable of being stuck in a shield because of the shape of its head without needing to bend. There are plenty of experimental archaeology videos on Youtube where people test the strength of the pila in close combat, and found that it works as a thrusting spear quite well.
Furthermore, we have several sources that states or portrays the Romans used the pila as a spear/melee weapon in close quarters combat. This is even more evidence to suggest that the pila was actually sturdy enough to not bend easily. Examples includes the following:
Thus, because many, if not most forms of pila were actually much sturdier than we used to think, this means that many would not be bent upon impact and could be retrievable after the battle.
Furthermore, as /u/white_light-king stated in the other comment here, the Roman army would have had blacksmiths who could repair their weapons and armor. These people could likely repair pila that were bent or damaged. And there would be undoubtedly times when some soldiers had to make do without certain equipment or with broken equipment if logistics broken down and/or when they were unable to be repaired or replenished in time for combat.