Rebuild failure: "extconf failed, exit code 1" -- due to old Docker?

Possibly. But on my system there’s a selection of such - might be worth a look, in case they are not just fossils.

ls -ltr /var/lib/docker/overlay2/*/*/var/www/discourse/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/rbtrace*/mkmf.log