Before r345132 chroot(8) stated:
If the -u, -g or -G options are given, the user, group and group list of the process are set to these values after the chroot has taken place.
chroot looks up the user, grop or group list before entering the chroot.
This leads to usernames that exist in the chroot not being found by the
command on the host and chroot erroring. Instead chroot uses the uid of
the username found on the host as the uid to use in the chroot. This
association is probably not correct and is working unintentionally.
Enter the chroot before looking up the user, group or group list.
Restore the previous sentence to the man page that describes this
behaviour.