The beauty of Windows is that everything is configurable through the registry if you look up the documentation. Usually you don't want to configure everything so in these cases Windows comes with sane defaults, but Microsoft has a way to override the URL that's being checked. See this article from eight years ago: https://www.ghacks.net/2014/02/07/disable-customize-windows-...
If you need some complicated algorithm, write a quick simple web server that runs on 127.123.45.67 and does all of these checks for you when the magical portal URL is requested. Then update your registry to point to that IP (or use hacks like editing your hosts file) and you've just added your special logic to every WinHTTP application on your computer. You can even point Windows to an endpoint only reachable over VPN if you want so the Internet check becomes "is my VPN operational", though that may break the VPN software itself.
Microsoft did a good enough job for all normal use cases of the Internet. Bespoke use cases need bespoke solutions, and they provide the ability to set that up without hacks if you want to change the standard behaviour.
If you need some complicated algorithm, write a quick simple web server that runs on 127.123.45.67 and does all of these checks for you when the magical portal URL is requested. Then update your registry to point to that IP (or use hacks like editing your hosts file) and you've just added your special logic to every WinHTTP application on your computer. You can even point Windows to an endpoint only reachable over VPN if you want so the Internet check becomes "is my VPN operational", though that may break the VPN software itself.
Microsoft did a good enough job for all normal use cases of the Internet. Bespoke use cases need bespoke solutions, and they provide the ability to set that up without hacks if you want to change the standard behaviour.