Interesting, I think this can be done relatively easily. I'd have to pull the logic to create the purified resource + sludge into an accessable library (e.g. baronSludge) and enable calls to that library. Once done, you'd be able to call a function with the inputs of the unpurified resource, the purified resource, and the sludge definition.
Once declared, all recipes that use the unpurified resource will be duplicated for the purified resource.
Technology unlocks are a bit harder, but I could create an input for that too. Let me give it a try and see if I can get you an interface.