I thought there was some hard coding as well, but that doesn't explain why ldd returns the correct dependencies for libgtk-x11-2.0.so.0 if it was hard coded somewhere I wouldn't expect ldd to have to do the library loading at all. I'd expect it to happen internally to libgtk-x11-2.0.so.0 using uselib(). I wouldn't expect ldd to know anything about the connection.
I thought there was some hard coding as well, but that doesn't explain why ldd returns the correct dependencies for libgtk-x11-2.0.so.0 if it was hard coded somewhere I wouldn't expect ldd to have to do the library loading at all. I'd expect it to happen internally to libgtk-x11-2.0.so.0 using uselib(). I wouldn't expect ldd to know anything about the connection.