You’re welcome! I provided an explanation of why it solved the issue below, but you don’t have to read it if it seems too long😁
Wi-Fi normally connects to a router, which assigns an IP address using a protocol called DHCP (Dynamic Host Configuration Protocol). But it’s possible to also use Wi-Fi to connect a group of devices to each other rather than to the Internet in what is called an ad-hoc network. Ad-hoc networks use IP addresses in the range that starts with 169.254.0.0. Each device in the ad-hoc network creates its own IP address in this range. When you connect a device to a network it will ask for an IP address using DHCP. If it doesn’t get an IP address assigned within 30 seconds it assumes that it is an ad-hoc network and assigns itself a random address in that range, which is useless for connecting to the Internet.
There is a common failure mode in many routers where the DHCP “daemon” process in the router fails, and it stops assigning IP addresses, so a new device connecting to the network will self-assign. But any device connected to the router that already has an IP address will continue to work. This makes it look like the problem is the phone, because everything else connected still works, but it’s actually the fact that the router is no longer assigning IP addresses. While it can happen to any device using the router the problem is more common with phones that disconnect when they go out of range, and reconnect when you get “home” and thus get a new IP address assigned. Rebooting the router restarts the DHCP daemon and resolves the problem.
The reason it happens with many different routers is that most routers have the same underlying open source operating system. It’s primarily a problem with routers more that a few years old; newer ones from top tier manufacturers have resolved this problem.