ECU does not know about the key I think, only about the box, and the only thing it cares about is the correct code to be received from the box. What the box itself does though I am not sure, that is, if there is one more level of checks - the box checks the code of the key and sends another code to the ECU, or perhaps the box only transmits the code from the key to the ECU.
But the bottom line is: if the ECU is coded then it needs to receive the only correct code it knows about from the immo box. You can reprogram things all you want on the key side, but it will not work until you program it with the right code. A decoded ECU will be virigin, it will assume nothing and program itself to the first code it receives on the immo line.