Please test one of the following strategies to see if it works:
To return the files to their original folder, try interacting with the serial console and running commands there.
Put the following into action:
A. Make a snapshot of the instance's current disc.
B. Attach the fresh disc with the restored snapshot to a different instance. Reverting files on the disc should be done after mounting the disc in that situation. Using the new disc, generate a custom image, then use that image to create a new instance. Verify that the new instance has successfully been booted. The initial faulty instance can then be deleted.