When your node has an inbound connection via the Tor network, the addr
field of the getpeerinfo
command shows the local port to which your local socket for the connection is bound. It does not show you any information about the host which requested the connection, nor does it show you information about any Tor relay to which your node happens to be connected. As you rightly point out, the addrlocal
field is your onion address (and port).
When the same node has an inbound connection via the ipv4 network (which is possible even for a Tor node provided it is properly configured) then the addr
field does show you the ip address (and port) of the requesting host, and there is no addrlocal
field.
So what appears to be "inbound connections to yourself" are simply inbound connections (from external hosts, not yourself) via the Tor network as opposed to the ipv4 network.