Haha this is funny. Does this even work for pages that are written with frontend frameworks? Needs a remix for 2024.
Virtual DOM refreshes might bring back the original style if not the elements themselves.
As insane as it sounds what probably makes more sense is to query for and remove the elements, generate a PNG of the page, delete everything in the body, and make sure the only child element of the body tag is your new img tag.
Also since you cannot unload or make undefined all the other js already running you may want to add some defensive event handlers on the body tag with MutationObserver.
https://developer.mozilla.org/en-US/docs/Web/API/MutationObs...