This https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1037327 and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1057708 are partially duplicate.
We could potentially re-apply https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/5545bb341808cef8a4227b55b0c75e331cc48c96 that was reverted in https://salsa.debian.org/mariadb-team/mariadb-server/-/commit/df439f3949df53b9685c5a0a8a57c2d9d1eb37cf as part of https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/36 but I am not sure if it makes sense. Contributions welcome!