Gmail does this by deliberately switching off the 'less secure apps' option so blocking access to the server. At times, Gmail will deliberately block POP and IMAP accounts that have an account setting that uses 'Authentication Method: Normal Password'.