This sounds a lot like emacs' old "undump" system, which ran the program, loaded a pile of elisp code, made itself dump core, then tried to massage the core dump into a runnable program.
Emacs ended up dropping that system because it was wildly incompatible with aspects of modern systems.