This sounds less like a router problem and more like an issue specific to the M2 Pro Mac mini.
The main clues are that the M2 Pro shows connected Wi-Fi, receives a normal 192.168.x.x address, and works through Ethernet, while the M4 Pro works correctly on the same router and the problem follows the M2 Pro to another house.
That makes a router fault or a general macOS Tahoe 26.5.2 issue less likely.
Before assuming hardware failure, I would check whether the Mac is actually receiving a valid internet route.
While connected only by Wi-Fi, open Terminal and run: route -n get default
A working result should show the router as the gateway and the Wi-Fi interface as the connection.
You can also test: ping 8.8.8.8
and then: ping google.com
If 8.8.8.8 works but google.com does not, the issue is probably DNS. If neither works, it is more likely a routing or network configuration problem.
I would also try forgetting the Wi-Fi network, restarting the Mac, and joining it again. Apple has a useful Wi-Fi troubleshooting guide here:
If your Mac does not connect to Wi-Fi
Another thing worth testing is IPv6.
In System Settings > Network > Wi-Fi > Details > TCP/IP, temporarily set Configure IPv6 to Link-local only and test again.
Some router and macOS combinations can have IPv6 negotiation problems that leave Wi-Fi connected but without working internet.
A Wi-Fi hardware fault is possible, but the fact that the Mac associates with the router and gets an IP address suggests the Wi-Fi hardware is at least partly functioning.
A failed Wi-Fi module more commonly causes weak signal, dropped connections, or inability to see networks.
The most useful comparison would be the Wi-Fi details from the working M4 Pro and the failing M2 Pro while connected to the same router.
Compare the IP address, router address, DNS servers, and IPv6 information. The output of route -n get default from the M2 Pro may reveal whether the Mac is missing its internet route.