Custom cycles node outputting shader
As far as I understand your question, node groups should work just fine. You can define exactly what parameters you want as input, and if a node has a 0 weight in a mix shader, then it will not be evaluated.
EDIT The manual says clearly that you don't need to worry about Mix Shader nodes performance.

When executing shaders, a special optimization is applied to Mix Shader nodes. If Factor evaluates to 0 or 1, any nodes that are only reachable via the unused branch of the mix are not evaluated.
This can substantially reduce the performance cost of combining multiple materials in one shader with vertex color, texture, or other input used as a switch.

Also Python code can control the material properties inside the node tree, and for this Python code you can create your own Python panel: Control Cycles material nodes and material properties in Python