I was having exactly the problem GP described a few years ago, and this was the fix.
It just about drove me nuts. It got to the point where I replaced my AP, started dragging a 10 meter ethernet cable around my house for my laptop, and started to suspect esoteric things like the local airport weather radar triggering DFS[^1].
In the end, it just turned out to be the damn Location Services.
If this is the case I could kiss all of you. I will try tonight!
I even went down the path of buying new powerline adapters only to have the same problem. I was unplugging things in the house and factory resetting everything. I've felt like I was going to crazy lengths to troubleshoot.
As a temporary measure, am I able to simply switch off the WiFi on those Mac devices before running those commands, to test?
You should only need to turn it off on the devices you're running the tests on.
I should have conditioned my previous comment with "if this is happening on an Apple device". In case it helps, I described what's happening under-the-hood in another comment: https://news.ycombinator.com/item?id=33451879
I was having exactly the problem GP described a few years ago, and this was the fix.
It just about drove me nuts. It got to the point where I replaced my AP, started dragging a 10 meter ethernet cable around my house for my laptop, and started to suspect esoteric things like the local airport weather radar triggering DFS[^1].
In the end, it just turned out to be the damn Location Services.
[1]: https://en.wikipedia.org/wiki/Dynamic_frequency_selection