[1.5.x] Fixed #19822 -- Added validation for uniqueness on USERNAME_FIELD on custom User models.

Thanks to Claude Peroz for the draft patch.

(cherry picked from commit f5e4a699ca0f58818acbdf9081164060cee910fa)