@Zac67
I see what you are getting at. You want to preserve the original game and any copy protection but you want to be able to make a copy of it for backup purposes which is not illeagle at all if it is not distrubted.
I can't code so I'm of no hope but ther were some devices made to help do exactly that. PerfectCopy was one such program that had some hardware you plugged in between the disk drive and computer. I think it made it a more direct drive to drive copy or something like that. There were other software programs that used paramater files that told the copy program how the program was recorded to the disk and therfore how to read it and duplicate it. I believe PerfectCopy and some other programs also did this. I still have a copy at home of the programs somewhere, I bought it in Australai as it was an Austrailian product and I did this when I bout a copy of Captain Blood. The disk stopped working and it was an $80 game at the time, I couldn't afford to get another copy so from then on I decided to back up games and only ever play the backup copies and leave the originals safe in a box somewhere.
I wish you good luck making a copy program for these reasons.