No, you would sign the agreement before doing all the restructuring. Doing it first would be silly
Except that the EU wouldn't let that happen. You need to do the restructuring before you become an EU member, the other way around would be rather silly for the EU.