state: hacks to support the env UUID upgrade for the machines collection

This change introduces a few hacks that are needed to allow a state
machine to start before the environment UUID migrations have been
applied to the machines and instanceData collections. Without this the
machine agent can't start in order to run the required database
migrations.