In IMAP, all mail is marked "seen" because Email Sync Option "ALL" gets changed

When “Incoming” is enabled, “Email Sync Option” can be set to “UNSEEN” or “ALL”, the latter meant to not mark mail as “SEEN”.

However, both settings do that and it is because in on line 288, this function changes “Email Sync Option” from ALL to UNSEEN:

		if not uid_validity:
			self.settings.email_sync_rule = "UNSEEN"

I would need some background to drill further. I assume the uid comparison is used to determine whether mails are fetched for the first time?