I don’t fully understand how this approach would solve the second problem (referencing the prompt in the template):
But I guess I need to compromise and enter the same input for multiple prompts (discard the usage of prompt references altogether).
I thought there might be a solution which is less risky than what you have suggested here.
I think finding the correct point would be rather difficult and unintuitive in the general case (as the references can occur at arbitrary places in the template).