A suggestion would be to treat destinations that do not need to traverse a gateway (ie local network) differently.
Browsers would need to implement this.
Further, they could present an initial dialog to 'trust' the local network. Obviously we don't want to do this in public Wi-Fi networks, but the OS already has a concept of 'private' vs 'public' networks, and the browser can easily know if the destination needs to be routed or it's local.