means that
someone makes plans or anticipates success before securing the necessary conditions or knowing the outcome.
The saying “To cook a hare before catching him” can be used when soemone celebrates too early, before they know the actual outcome.