As this is something that in theory shouldn't happen and we can't add guards for everything, I'm closing this for now. We haven't seen documents wrongly marked as non-existing for quite a while now and assume that the mentioned issues were caused by stack overflows that have been fixed by XWIKI-23303.
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.