I know this is months ago, however....
I only get this login loop using Firefox, with Chrome everything works. Including OTP prompt and successful logins.
I only discovered keycloak yesterday, so I'm not up on how it really works, but I'm still searching and have found others with this issue, but only one notes the other browsers work while firefox does not.
Firefox, fresh install, no addons at all, issue exists.
Chrome, fresh install, everything works.