Just finished configuring Evolution on my Gmail account with IMAP. I had to fiddle around with the settings... making sure that the correct port numbers, etc, were set in Evolution to match Google's instructions. I found that STARTTLS did not work for me, but TLS on a dedicated port did. After enough fiddling around, a popup window came up and I had to log into Gmail from there (in Evolution) and tell Gmail to give Evolution permission to do all this. Once granted, then it all took off okay.
At no time did I see the error that you have though. Besides pop email being disabled, I also do not use two-factor authentication, but the Evolution setting for receiving and sending shows "OAuth2 (Google)" as the authentication type.