(Example screenshot taken from https://askubuntu.com/questions/1343872/ubuntu-shows-other-users-are-logged-in-whenever-i-shut-down-even-though-i-am-the)
But my question is: how does the system know this? I have done
sudo chmod o-r /var/run/utmp
sudo chmod o-r /var/log/wtmp
And I verified that my user cannot run w or who anymore: the command output is empty because of read permission denied in utmp and wtmp.
So how does the system know this? Where is the information leaking?

w,who,psetc. commands? Or are you only interested in getting rid of this box?