Debug isn't particularly helpful, the server response comes back and the SCRAM just fails. I suspect the old librdkafka is using the unversioned SASL auth method that was deprecated or something similar? Kafka 4.0.0 is supposed to be baselined back to 2018, and librdkafka 1.8.2 came out in 2021, but for whatever reason this is broken.
I upgraded to librdkafka v2.10.0 and build the alpine release for the dockerfile with 3.21.3 and SCRAM-SHA-512 works again. I'll open a PR to resolve this issue with the changes.