Smart mailbox for unread messages in Mail.app Problem

I've created a smart mailbox in macOS Mail for "Unread" messages with the following rules:


  Contains messages that match all of the following conditions:
  
  
  Message is in the mailbox: Inbox
  Message is unread
  


The smart mailbox will always correctly include unread messages in my inbox. But often, it will incorrectly include read messages in my inbox. Any ideas on how I can fix this?

Other information and troubleshooting steps so far


Currently using macOS Sierra 10.12.6
Email account is hosted by Google
Other smart mailboxes with other rules still work properly.
If I use the filter button in my inbox, Mail will properly perform filtering -- even for unread messages.
I tried marking the problematic messages as unread and then as read again. Afterwards, the number next to the title of the "Unread" mailbox will decrease (because I have taken steps to mark messages as read), but the "Unread" mailbox itself will still list those messages (even though they are read).
I tried the above step from gmail.com. Same result.
I tried getting new mail. Nothing changes. I tried rebuilding my mailboxes. No rebuilding happens.
I tried rebooting my computer in safe mode. Then, any smart mailbox I created would contain no messages regardless of the rules I set.
There doesn't seem to be any pattern to which messages are problematic.
My "Unread" smart mailbox still behaves properly for non-problematic messages even if it contains problematic messages.
Once a problematic message appears in my "Unread" smart mailbox, it will stay there for a few days. Then, it will suddenly leave "Unread" and sit in my Inbox where it belongs.
Spotlight is responsible for searches, so I would add your home folder to the spotlight system preference privacy settings. 


Then say Ok to any prompts that mention search will break. 
Then remove your home folder and let the indexer re-index mail messages. 
Restart after 30 minutes if you don’t see an improvement 


There are more drastic and questionable options, but let’s start with safe and easy.