I've seen/fixed similar issue in someone else's Windows 10 notebook few days ago. It seems to have been caused by wifi having the same ssid for 2.4 GHz and 5 GHz and not-that-great signal so OS was for some reason "constantly" switching between those two. After forcing it to use just 5 GHz it went from 1 Mbps to 100 Mbps. Reading this sooner would have prevented my headache.
You can set BandModifier2_4GHz=0.01 to make 2.4GHz 1/100th as preferred in the excellent excellent iwd daemon (or 0 for disable).<p><a href="https://man.archlinux.org/man/iwd.config.5.en#Rank" rel="nofollow">https://man.archlinux.org/man/iwd.config.5.en#Rank</a>
Cross-compiling ? Aren't M1 and Pi both ARM processors ? I've been building apps for my M1 to run on Pi without any issue. Some optimization options maybe ?