Proxychains-ng of some distros (mainly Arch) may be incompatible with libraries in ImageBuilder's staging_dir/host/lib/

I prefer using proxychains-ng (proxychains4) for pulling online packages through a faster SOCKS5 proxy when building images with ImageBuilder. After recent updates of my Manjaro system I found out that proxychains-ng cannot work with the ImageBuilder out-of-box now, citing missing version GLIBC_2.34 in libc.so.6. Further inspection shows the binaries in staging_dir/host/bin are using libraries in staging_dir/host/lib rather than my system's. Those binaries still works out-of-box if run without using proxychains4, though.

Currently Manjaro is using glibc version 2.36 and it seems replacing at least the following libraries with those from my system will fix the problem:

libc.so.6
ld-linux-x86-64.so.2
libpthread.so.0

Don't know if I need to replace other libraries, but replacing these three libraries is enough to let opkg alone work with proxychains-ng. I can just modify related sections inside include/rootfs.mk to let only opkg go through the proxy while other commands that do not need Internet can run as-is. In this way the image creation can finish without other major issues.

For now I simply copied the library files from my system's /lib to ImageBuilder's staging_dir/host/lib. I think pointing them directly to the files my system uses via symlinks may be better, but the problem would be that different distros may put libraries in different places which can make symlinks valid for some but not others.

I think this issue is mainly affecting Linux distros with much newer versions of system libraries at the moment, like Arch, which Manjaro is based on.