So this is kind of way off in left field, especially on a MacBook Air. I've usually seen it on Mac Studios.
My day job is working with a piece of security software that includes a firewall, but this behavior could also be seen if you had a VPN installed.
It turns out that there is a limit in MacOS to the number of network interfaces a program can bind to. If there are more network interfaces in the system than the limit, and you have a program that tries to bind to all of them, network functionality has a tendency to die.
There are a lot of things on a Mac that are treated as network interfaces. Every individual thunderbolt port, for one, which is why this typically affects Mac Studios with 4 or 6 TB ports. The MBA only has two so it doesn't seem super likely.
However, it's possible your normal configuration is right at the threshold, and adding an additional network interface is going over it.
Apple increased this internal limit with 12.4 and then doubled it again with 13. So if you're already on 12.4 or 13 then this probably isn't the issue and you can ignore this entire post. But if you aren't, maybe try upgrading the OS.
If you run these two commands from a terminal, what do you get?
networksetup -listallhardwareports
ifconfig
You'll probably need to run both of these with sudo.