First a bit of background
Bare with me as all of below should be relevant.
I currently have a HTC 10, so does my father. My phone I bought from eBay and it came with the Nougat (7.0) update already installed (lets call it phone 1). My dads phone came directly from HTC with Marshmallow installed (phone 2). Both devices are the same factory unlocked EMEA version of the phone.
On "phone 1" I had no Wi-Fi issues, and initially neither did "phone 2". Shortly after purchase we updated "phone 2" using OTA updates to the same version of Nougat (7.0) as I have (it had the same HTC version number). This started causing Wi-Fi problems on "phone 2". Because it became a problem only after the update, that rules out a hardware issue. Furthermore because "phone 1" didn't have the issue I can rule out the Wi-Fi router as the cause.
HTC released a new OTA update for 7.0 with the July security patches. I updated "phone 1" using this OTA and suddenly I have the same Wi-Fi issue as on "phone 2". I tried to no avail wiping the cache partition and also going to the extreme of doing a full factory reset. The problem remains on both phones.
After some playing around with various Wi-Fi settings on the phone (static IP, disabling battery optimisation, disabling mobile data), I the issue remained.
We then tried to do the OTA update on "phone 2" and it revealed some interesting information. During the download it would happily download roughly 10MB of data (sometimes 7MB, sometimes 10MB, once it jumped 30MB). After this the Wi-Fi would remain connected, however the phone could no longer contact the internet. If I turn the Wi-Fi off and on again, it will download another ~10MB and then no internet again. Repeat ad infinitum.
I tried to download a couple of apps from Google Play on "phone 1" and noticed the problem is the same - it downloads ~10MB then no internet. Turning the Wi-Fi off and on again, another ~10MB.
I saw on Reddit (here) that entering into the phone app the number
*#*#4636#*#* loads some testing phone settings. Looking at the Wi-Fi status in that I can see that the phone connects to the internet after turning on the Wi-Fi by running the ping test which passes. After downloading a chunk of data over Wi-Fi, the ping test fails stating "unknown" as a result, then shortly afterwards changing to "Fail: Host unreachable". This shows the internet connection was for some reason lost, however the Wi-Fi status still shows that the network state is still "Connected to SSID".
Is there a solution to this issue?
It's an odd problem that seems to be very repeatable, but I can't seem to find any settings that fix the problem.