Not able to add node sockets to an existing node using python scripting
Found out from here that instead of adding sockets to these node using the node.inputs collection, the node.file_slots or node.layer_slots collections should be used. Both of them work, they just provide slightly different properties for use with simple files or multi-layer EXR.