Since which Android version does it detect internet connectivity on Wi-Fi?
The "Smart Network Switching" is available since Android 5.0.

You can see it in the official changelog here (in "see all features", "connectivity" : «Improved network selection logic so that your device connects only if there is a verified internet connection on Wi-Fi»).