I would also imagine that there could be a food and drug safety prover that would simulate billions of prompts to see if the replicator would ever have a safety violation that could result in horrible nerve agents from being constructed.
The better idea is the simplest one: Don’t replace the perfectly functioning replicators.
Think about protein folding and enzymes. That's all solved with probabilities and likely outcomes for the structure and the effect it has. Any replicator would already need to prove the things it is allowed to create, adding the items that it is not allowed to create is probaly needed as a safety protocol anyway.