They’re actually running as a namespaced UID. The processes inside the container see UID 1000, but it’s actually a different UID 1000 from the host filesystem.
The actual starting command is run as sudo -E -u discourse bla bla bla, and discourse in the container gets the first “free” user UID, which is 1000.