This is Google's lovely FRP (Factory reset protection) system, pretty much not a good idea to reset an Android device if you forgot the lock screen passcode as it usually messes things up.
Rules for FRP to enable itself:
# Lockscreen passcode (LG KnockCode, PIN, Password)
# Google Account...