gf: fix some issues with the move from using a tree to a hash lookup of leaf types (#36413)
Addresses an off-by-one in the type lookup, ensures we look at at all
entries when doing invalidation, and allows putting any Type{T} object
also in the cache (I forgot these always had `simplesig`, so we needed
to handle that case too to receive the benefit for them).