pack: init the cache on packfile alloc

When running multithreaded, it is not enough to check for the offmap
allocation. Move the call to cache_init() to packfile allocation so we
can be sure it is always allocated free of races.

This fixes #2355.

helgrind doesn't show issues with `cache_init` anymore, just a bunch of races that we use for convenience.

/cc @phkelley