Create jiterator cache dirs recursively
Fixes #74415
@mruberry
The change expects the base directories (`HOME/TEMP`, `XDG_CACHE_HOME`, or the user-defined `PYTORCH_KERNEL_CACHE_PATH`) to exist to avoid potentially exploiting the recursive folder creation.
Let me know, if this is not a concern from your side and this PR should be simplified.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74425
Approved by: https://github.com/mruberry