For anyone who has experienced this, I found a fix:
https://technclub.com/guides/fix-oauth-2-0-error-400-apple-mail-mac/
My Google Settings looked a bit different, so just do an internet search on "Google App passwords", and you will find the right place.
Before that, you need to delete your account from "Internet accounts" in the system preferences. Then proceed to create a new mail account in Mail (after deleting your old accounts). This time, don't chose "Gmail", but "other account" instead.
Then go to the Google App Passwords, create an App Password, and then enter it in Mail.
That's it. Still annoying, but at least it works.