Set the prototype after all the mutations to allow optimizations

Some VMs optimize objects when they are set as a prototype.