Why is it suggested to cache cache dirs, not package dirs?

For python they suggest pip cache dir, for nodejs npm config get cache. Installing packages from cache can also take some time.

What I have right now:

      - name: Get site-packages-dir
        id: get-site-packages-dir
        run: |
          code='import site; print(site.getsitepackages()[0])'
          dir=`python -c "$code"`
          echo "::set-output name=dir::$dir"

      - name: Restore the pip cache
        id: restore-pip-cache
        uses: actions/cache@v2
        with:
          path: ${{ steps.get-site-packages-dir.outputs.dir }}
          key: pip-${{ hashFiles('requirements.txt') }}
          restore-keys: |
            pip-

      - name: Install pip dependencies
        if: steps.restore-pip-cache.outputs.cache-hit != 'true'
        run: pip install -r requirements.txt


      - name: Restore the yarn cache
        id: restore-yarn-cache
        uses: actions/cache@v2
        with:
          path: |
            node_modules
            ~/.cache/Cypress/3.4.1
          key: yarn-${{ hashFiles('yarn.lock') }}
          restore-keys: |
            yarn-

      - name: Install yarn dependencies
        if: steps.restore-yarn-cache.outputs.cache-hit != 'true'
        run: yarn install