fix missing uuid check on extension when finding the location of an extension (#54658)
in stacked environments with name collisions of extensions, this could
compute the path for the wrong extension
Fixes https://github.com/JuliaLang/Pkg.jl/issues/3906