Re: Thunderbird for the win
Of course POP3 understands which mails *this specific device* has downloaded before. A decent POP3 client, like Thunderbird, associates each message with a unique ID which is also on the server, so it only fetches the ones *that device* doesn't yet have. I run POP3 on multiple clients and it works like a charm. The server doesn't even care if it has been downloaded before; that's a client function.
Minor aside: The old (>20years dead) Eudora Worldmail server implemented an extension wherein the server *did* keep track of whether a message had been downloaded at least once, and the Eudora client, as well as the KMail client, noted it, so you'd download mail and see if it's entirely new or just new to that client. That was essentially an extension based on an IMAP capability.
In general, though, IMAP sucks the big one! In theory, the protocol is capable of doing everything you want. But I've never met a decent implementation of the protocol. Instead, T'bird and everybody else ONLY supports using IMAP as a "sync" protocol, a cheaper version of the Lotus/Microsoft corporate mail model where everything is always on The Server and the client is just a viewport and IT is in control. That is not inherent in the protocol but if you like keeping local copies, then IMAP on T'bird is not your choice. In theory you can copy the sync'd mail to a Local Folder for keepsies but doing that through a filter is not reliable, just hit-or-miss copying some but not all messages.
And Yahoo, heavily enshittified, nowadays limits its IMAP server to seeing only the last 10,000 message; older one are on the web mail site and ironically can be pulled down via POP.