It’s not implemented in the Linux kernel, but the latency penalty you’re describing is part of the “Happy Eyeballs” algorithm: https://en.wikipedia.org/wiki/Happy_Eyeballs