I avoid this by creating static DNS entries in the router creating so a pool of IP addresses that apply to that specific VPN connection.
When you are depending on external server to return the dynamic IP address of the peer then you could store that in static DNS entry every so many minutes. Use the static entry then as endpoint address.
When the internet connection is restored and in the meantime the IP address on the other side has changed, then after updating the static DNS entry that you can script a restart of the WG peer…swatting so two flies in one hit.