CRM_ACL_BAO_Cache::updateEntry is bonkers and possibly even broken
The function mentioned seems to be written in such a way as it is trying to do two jobs at once which seems very very odd indeed.
Firstly the $id param isn't clearly spelled out however when it calls the deleteEntry() function it seems that the $id is of the contact being viewed.
however later on when it calls getAllACLs for contact and also build the cache table it is now believing that $id is the contact id of the user trying to access the contacts. Which makes more sense but still feels very much odd ball.