You can have safeguards against contamination but these safeguards aren’t 100% reliable. The article reports “substandard” chemicals and that’s an umbrella term that includes contamination and many other problems.
Speaking as nothing more than a hobbyist, I can tell you that analog photography suffers from many of the same problems you might see in semiconductor manufacturing, only on a much smaller scale. I used to mix my own photochemicals from raw reagents and it’s a complex subject, to say the least. Exposure to air and minerals in the water have all sorts of effects, and the standard way to test your process is just to run film through it. I’m sure that fabs have better testing equipment than I do, but at the end of the day, it’s not feasible to test everything and I’m not surprised that a bad batch of chemicals made it through, ruining many batches of wafers due to the sheer depth of the manufacturing pipeline.
With photochemicals, a small change in the developer formulation can result in what is more or less a completely black and unworkable negative, or possibly a blank negative. I expect semiconductor manufacturing to be similar, since both processes rely so heavily on knowing reaction rates. Kinetics is complicated, to say the least. For photochemistry I rely heavily on using known developer / film concentrations and being borderline religious when it comes to temperature and time.