NOTE: This page is a recollection of what I've written previously. I do not guarantee it's accuracy.
While GIO does provide a means of referencing icons for the sake of filetypes and apps, it’s GTK which implements the standard logic for looking them up.
To do so it reads a number of fallback icon themes (some of which are built-in) from standard directories, parsing their index files into a flattened list of “icon directories”. And for each of those icon directories, it caches a hashmap of all available icons allowing presence checks to be very rapid. This updates after GTK’s settings are updated.
Then looking up an icon simply involves finding the first/closest-in-size icon directory which contains the desired icon name, normalizing different strategies for comparing icon sizes into a “score”. Those icons are then decoded via GDK pixbuf and it’s supporting libraries before being added to an LRU cache, evicting icons only when they’re no longer in use according to their refcount.