Gateway: GatewayService should register cluster state listener before checking for current state

At the moment we may miss a state change and fail to recover on time.

Closes #8789