fix(cache): fix restoration issues of directories with very long paths (#7628)
### Description
Fixes #7410
This is just #6662, but applied to directories. See
[Entry::path](https://docs.rs/tar/latest/tar/struct.Entry.html#method.path)
for explanation as to why one should never rely on a header's path.
### Testing Instructions
In the first commit added a failing unit test, test passes after fix.
Also tested against reproduction:
https://github.com/trappar/turbo-cache-missing-output-files
Just need to update `reproduce-issue.sh` to use the `turbo` in this
branch:
```
...
Diffing the original force-build's .next directory with the cache-hit-build's .next directory
[0 olszewski@chriss-mbp] /tmp/turbo-cache-missing-output-files $
```
Closes TURBO-2532