This Jupyter Notebook prompts the user for a layer to replace, and a layer to replace it with, then it loops through all of the web maps the user has access to and replaces the layers. Check it out, I hope it helps...
ArcGIS Online Replace Layer in a Web Map