The idea of a modular and patchable shader system is marvellous, but I guess it would need some more thought than "just glue some strings together and done we are". I think tmp's the template-approach might be an excellent start though.
Issues will arise, because if you simply conconate functionality that eventually ends up in a single hlsl function, we would have to take great care, that variable names and types match everywhere. Usually the compiler will warn you, if you write them by hand, but with a disjunct system it might just not.
So we want to keep the error reporting and syntax checking. For that it would be necessary to restrict output to (self-contained) functions from a plugin, basically like a fxh file. The final shader could then be composited of those very helper-function calls.
This observation could be turned into working systems a couple ways, investigating the best is sure a thing for the hive mind.
I think it might be promising to investigate, if a proper fxh-util-lib could be sufficient (in theory, and with some practical monkeywork), and later look into adding a plugin-factory for fxh files to make their functions and classes pluggable for any "shader patch"
that said, and all pragmaticallity aside, I still have dreams of a system, where patchers could decide, if a patch runs on the gpu or the cpu (similar to ctrl+b, or with regions), and affected nodes switch their code generation between msil and hlsl...