Largely ignoring the question of why it was designed this way, here is an explanation of how UID and UIDVALIDITY work together in IMAP:
The UID is a unique identifier assigned to each message, scoped to the specific "mailbox".
The "mailbox" in the context of UID handling is effectively identified by the combination of:
- The mailbox name (eg: INBOX)
- The UIDVALIDITY value (suggested implementation: creation date of the mailbox)
This is essentially a cache-management mechanism, such that a new mailbox with a name that has existed before does not confuse a client that had also seen the old mailbox by that name (such that an IMAP server implementation is not forced to retain UID state of deleted mailboxes)