Update all materials, but keep their color and textures
import bpy
for material in bpy.data.materials:
    if (material.use_nodes):
        nodes = material.node_tree.nodes
        links = material.node_tree.links
        for node in nodes:
            if (node.name=='Material Output'):                            
                out = node
            elif  (node.name=='Image Texture'):
                img = node
            elif: (node.name=='Diffuse BSDF'):
                diff = node
                # if diffuse node is not linked,then save it's colorvalue
                if not(node.inputs[0].is_linked):
                    color = node.inputs[0].default_value
                else:
                # else we should set color to None, and be aware
                    color = None
            else:
                nodes.remove(node)

        hold = nodes.new('ShaderNodeHoldout')
        geo = nodes.new('ShaderNodeNewGeometry')
        mix = nodes.new('ShaderNodeMixShader')
        RGB = nodes.new('ShaderNodeRGB')
        if (color==None):
            if (img==None):
                #No image and diffuse was not empty, set color to grey
                RGB.outputs[0].default_value = (0.7,0.7,0.7)
                img = RGB
        else:    
            RGB.outputs[0].default_value = color
            img = RGB

        links.new(out.inputs[0],mix.outputs[0])
        links.new(mix.inputs[0],geo.outputs[6])
        links.new(mix.inputs[1],diff.outputs[0])
        links.new(mix.inputs[2],hold.outputs[0])
        links.new(diff.inputs[0],img.outputs[0])


This code does almost what you want.
It saves one image texture node, one material output node, and deletes everything else, and then adds emission and holdout node and connects them via backfacing. As for part of your own shader, i think you can save it as a node group and append it into node setup via python too