state: pass environment uuid via config rather than generate it during initialize

In order to have the uuid of the environment available _before_ state is initialised the uuid is now a part of the environment configuration.

This PR also contains some drive-by cleanups to state tests to make them more robust if they fail.
I think we want this to be done at Prepare time, so that it makes its way into .jenv. Also, it would allow us to assume the UUID is valid/present in spite of a failed bootstrap.