Component locked in GHPython while creating sublayers

Keep recieving “ModelComponent.set_Id failed. The component is likely locked.”

To me it appears that you are trying to set multiple layers at once with rs.AddLayer, and I think this is not possible. Try to iterate over your names_elements instead.
If possible always add the .gh or script file to your post, which makes it easier for us to help you out.