Hassio doesn't boot correctly after Power outage

I have a problem with my Raspberry pi 4 Hass.io booting up after a power outage.

The last 6 months i have had 3 power outages du to some work in the appartmentbuilding. (We usually dont have power outages.)

Evrey time the power has gone and come back, i can´t gain access to my HA.

My theory is that the raspberry pi boots up before my wifi-router, and thus it does not connect to the network.

What to do?

Put both on a UPS. Shutting off the RPi as is happening when your power goes off, will eventually cause a bigger problem. Lost data!