pack-objects: move thread autodetection closer to relevant code