Move temp path creation logic into new TempPathRegistry

Using `Tempfile` is unreliable as there is no guarantee that the
generated temporary file's directory will not be deleted after calling
`Tempfile#close!`.