Instead of the hack we have at the moment, we should use patchelf, which actually understand the structure of ELF binaries and edits them in-place.
Here's a script that was tested on the WPE WebKit bootstrap tarballs we get from Cerbero, which I think could be used as-is: