Looking at the code-flow, it is a design issue where
rebuildUnreadConversationCountForUser() is accessing other user's conversations inside a transaction which is modifying their own conversations.
This leads to a potential interleaving of updates & selects on the same rows which can cause a deadlock.
Moving the rebuildUnreadConversationCountForUser() call into XenForo_DataWriter_ConversationMaster::_postSaveAfterTransaction effectively fixes this, as it break apart interleaving update/select/update statements.
This is a fairly minor thing, but it crops up every so often.