For changing names of model.layers with tf.keras you can use the following lines:
for layer in model.layers:
layer._name = layer.name + str("_2")
I needed this in a two-input model case and ran into the “AttributeError: can’t set attribute”, too. The thing is that there is an underlying hidden attribute _name, which causes the conflict.