This small PR adds test coverage for the scenario of connecting to ourself, leading to an immediate disconnect: https://github.com/bitcoin/bitcoin/blob/2f6dca4d1c01ee47275a4292f128d714736837a1/src/net_processing.cpp#L3729-L3735
This logic has been first introduced by Satoshi in October 2009, together with a couple of other changes and a version bump to “v0.1.6 BETA” (see commit cc0b4c3b62367a2aebe5fc1f4d0ed4b97e9c2ac9).