Throughout Breaking Bad we are shown how pedantic Walt is with contamination.
The only time Walt is "pedantic" in the way that you reference is when he is in the lab cooking meth.
Breaking Bad S03E10 – The Fly
*Note: and it's worth mentioning that episodes like 'The Fly', where Walt shuts down an entire lab session in order to chase after a fly isn't actually about the fly or contaminants, it's a metaphor for Walt's losing control.
The train heist you mention involves capturing a massive amount of Methylamine, which is just used as a precursor for methamphetamine – Jesse and Walt use reductive amination of P2P (phenylacetone) to synthesise methamphetamine, to avoid having to rely on pseudoephedrine.
According to the chemical properties of Methylamine, separating all the sand and contaminants from the methylamine is relatively easy:
Because methylamine has such a low boiling point, simply basifying the solution during distillation would readily separate the methylamine from anything else that could be present in the contamination.
Considering Walt and company are risking getting arrested by the authorities during their train heist, and he is not actually cooking, just grabbing one of the ingredients, things like "Getting the job done as fast as possible" takes priority over a thing like Walter's penchant for being clean and pure during the cooking process.
The writers could have added in the dirt and "carelessness" as a way to contrast it from Walt's usual behaviour when dealing with chemicals, thereby upping the tension and making the time-sensitivity dilemma all the more impactful to the audience, who, as you say, is not accustomed to this kind of "carelessness" from Walt.