gobject-introspection: fix non-/usr/local installs

Closes #29014.