Reduce calls to state.render in migrations

`state.render` is actually very long, so this commit easily reduce the
number of times it needs to be called by moving some calls only after
`allowed_to_migrate` was called (to avoid calling render states we won't
need). Useful when `allow_migrate` returns false

No new tests because the full test suit still pass and there is nothing new.