I think it's because pkg-config.bat doesn't understand "${prefix}" like MSYS2 does.
It's not so much that the pure perl pkg-config does not understand ${prefix}. It's more that it does not correct for the MSYS2 paths.
The mingw64 glib-2.0.pc file is below. The prefix is set to a location that only MSYS2 knows how to convert to a "normal" windows path.
If the prefix is set to prefix=${pcfiledir}/../.. then the issue might disappear. FWIW, this approach is used for all but one of the .pc files under strawberry perl 5.38 (that file being zlib.pc).
prefix=/mingw64
includedir=${prefix}/include
libdir=${prefix}/lib
bindir=${prefix}/bin
glib_genmarshal=${bindir}/glib-genmarshal
gobject_query=${bindir}/gobject-query
glib_mkenums=${bindir}/glib-mkenums
Name: GLib
Description: C Utility Library
Version: 2.76.4
Requires.private: libpcre2-8 >= 10.32
Libs: -L${libdir} -lglib-2.0 -lintl
Libs.private: -lws2_32 -lole32 -lwinmm -lshlwapi -luuid -lm
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include