The easiest way to do something often is not to do it, but just pretend you did it.
For instance, when claiming to delete a file, it is often far easier to just move it to another directory on the same disk. That's just a matter of copying the metadata (directory entry) over.
Use that lesson: to "change" your executable, rename it (allowed while running), copy it back to its original name (officially a new file, not in use), and change the new file with the old name.