Try -XX:+StartAttachListener , might “just work”.
Dunno why, just determined to understand the issue, keep my brain busy!
EDIT: I am quietly confident adding -XX:+StartAttachListener will “just work”, as that does not seem to then even log the [debug][attach] File .attach_pid… messages, So I think that part of the (JVM) code is not even called when that option is given, so you avoid the .attach_pid* file being created in the log directory, and issues therein, completely.
% /usr/share/elasticsearch/jdk/bin/java -XX:+PrintFlagsFinal -version | fgrep StartAttachListener
bool StartAttachListener = false {product} {default}
openjdk version "25" 2025-09-16
OpenJDK Runtime Environment (build 25+36-3489)
OpenJDK 64-Bit Server VM (build 25+36-3489, mixed mode, sharing)
check your own JDK has that option, no idea when it was introduced.