Avoid duplicate stat calls during startup/loading (#55331)
Avoids immediately successive stat calls for the same path during
startup & loading.
According to MacOS Instruments this reduces `stat64` calls during
`--start=no -e "using Pkg"` from 844 to 672.
On MacOS I don't see a speed improvement, but on WSL2 @timholy reported
the test from https://github.com/JuliaLang/julia/issues/55171 sees a
modest improvement.
This PR (10 iterations)
```
tim@diva:~/.julia/bin$ time for i in {1..10}; do ./cli --help &> /dev/null; done
real 0m2.999s
user 0m3.547s
sys 0m6.552s
```
master
```
real 0m3.217s
user 0m3.794s
sys 0m6.700s
```
1.11-rc2:
```
real 0m3.746s
user 0m4.169s
sys 0m6.755s
```
I left the `@debug`s in as they might be useful for similar
investigations.