I am a bit blurry on the details because I worked on that almost 10 years ago to support a program that used (and abused) `$ORIGIN`.
I ended up pushing the executable filename through the aux vector to the dynamic linker, which is simar to what you mention AFAIU.
Never managed to get that merged upstream though. Glad to know there's now a _standard_ way.
`getauxval(AT_EXECFN)` is "better" but there are weird edge cases with `fexecve` where you only get `AT_EXECFD`, even ignoring the inevitable TOCTOU.