I made myself a script that converts 3 top layers to R, G and B channels, output is the 4th layer below them. Feel free to use/modify.
Input 3 layers for each channel + BG layer:

Output:

function main()
{
var i;
var channels = ['Rd ', 'Grn ', 'Bl '];
// making 3 top layers invisible
for (i = 0; i < 3; i++) {
activeDocument.layers[i].visible = false;
};
// select BG layer
activeDocument.activeLayer = activeDocument.layers[3];
// applying layers as channels
for (i = 0; i < 3; i++) {
selectChannel(channels[i]);
applyImage(activeDocument.layers[i].name)
}
selectChannel('RGB ');
function selectChannel(id)
{
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID(id));
desc.putReference(charIDToTypeID('null'), ref);
executeAction(charIDToTypeID('slct'), desc, DialogModes.NO);
}
function applyImage(layerName)
{
var desc = new ActionDescriptor();
var descWith = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('RGB '));
ref.putName(charIDToTypeID('Lyr '), layerName);
descWith.putReference(charIDToTypeID('T '), ref);
descWith.putBoolean(charIDToTypeID('PrsT'), true);
desc.putObject(charIDToTypeID('With'), charIDToTypeID('Clcl'), descWith);
executeAction(charIDToTypeID('AppI'), desc, DialogModes.NO);
}
}
app.activeDocument.suspendHistory("combine to channels", "main()");