Note that psql --version and docker exec data su postgres -c "echo 'select version();'|psql"|grep PostgreSQL|cut -d " " -f 3 are not the same thing.
I think that the image has up-to-date client tools (that work for people who are running later versions of postgres that Discourse (probably) supports) and hasn’t force everyone to update to PG15 or whatever the plan is just yet.