When you go to a good key cutter, they have a machine to read and transfer codes. All that the ecu does is learn the codes, it doesnt transfer the codes into the key. ECU is a computer whose codes sequence keeps on changing (its all complex electronics). All that the red key does is that opens the programming circuit of the ecu to make the ecu learn the new codes in the blue key. I am not sure but just for security measures it needs two different codes.
Now you say you are in option 1, it means ecu is loosing codes. I dont know may be loose connection to the ecu power supply.