Bitcoin Core won't automatically IP-ban misbehaving peers if the IP address is local, but doesn't apply the same logic to manual bans. I found this out the hard way when I accidentally banned an inbound Tor peer and took down my hidden service. I didn't even realise what happened until, wondering why my node had no inbound Tor connections, I checked my debog.log and saw it was filled with "connection from 127.0.0.1 dropped (banned)".
Is there any legitimate use for this behaviour or is it just a straight-up bug? It seems inconsistent, at least.