Creating a layer that duplicates a sub-model a variable amount of times

When creating a Siamese Network you create a model and instantiate it twice. I wish to create a layer that will instantiate the model a variable number of times based on the input. It will then take the outputs of all of those models and do the distance math returning a fixed number of outputs.

Important notes: The model is not pretrained, the goal is training that model. While not required, I would prefer the replies in relation to keras.