Repository: storybook
Issue: [Bug]: Storybook fails to resolve yarn Plug N Play, (Babel?) dependencies 
Labels: bug,yarn / npm,needs triage

### Describe the bug

When I run `build-storybook` I am seeing the same error output behavior that is reported here: https://github.com/storybookjs/storybook/issues/18801#issuecomment-1410297530

The `build-storybook` hangs indefinitely and fails to terminate or complete.

I only see these errors when I use yarns 'plug n' play' mode or 'zero-installs'. If I change the yarn `nodeLinker` value to `nodeLinker: node-modules`  then `build-storybook` works successfully.

I tried to follow the advice from https://github.com/storybookjs/storybook/issues/18801#issuecomment-1382079840
and try upgrading with
`npx sb@next upgrade --prerelease`

However the upgrade process then fails at the babel migration step with error:
```
✅ ran autodocsTrue migration
⚠️  failed to check fix missing-babelrc
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@babel/plugin-proposal-class-properties' imported from /Users/kevzettler/code/react-regl/babel-virtual-resolve-base.js
    at new NodeError (/Users/kevzettler/.npm/_npx/eebb2d3a7d26a7f1/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:2240:5)
    at packageResolve (/Users/kevzettler/.npm/_npx/eebb2d3a7d26a7f1/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:2776:9)
    at moduleResolve (/Users/kevzettler/.npm/_npx/eebb2d3a7d26a7f1/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:2804:18)
    at defaultResolve (/Users/kevzettler/.npm/_npx/eebb2d3a7d26a7f1/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:2835:13)
    at /Users/kevzettler/.npm/_npx/eebb2d3a7d26a7f1/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:2855:14
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/kevzettler/.npm/_npx/eebb2d3a7d26a7f1/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:45:103)
    at _next (/Users/kevzettler/.npm/_npx/eebb2d3a7d26a7f1/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:46:194)
    at /Users/kevzettler/.npm/_npx/eebb2d3a7d26a7f1/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:46:364
    at new Promise (<anonymous>) {
  code: 'ERR_MODULE_NOT_FOUND'
}
```
furthermore, if I revert and then use execute `npx sb@next upgrade --prerelease` while using yarns `nodeLinker :node-modules` mode. It passes successfully.

This leads me to believe in my case there is a module resolution issue possibly with the .babelrc storybook is processing

### To Reproduce

I have created a reproduction repository here:
https://github.com/kevzettler/storybook-bug-example
This happens with the following dependencies
Node version v16.13.0
yarn -v
3.3.1

You can execute the following shell command sequence to setup the repo and trigger the failure case
```
git clone https://github.com/kevzettler/storybook-bug-example.git && cd storybook-bug-example && yarn install && yarn build-storybook
```

You can then execute `npx sb@next upgrade --prerelease` to see the upgrade failures.

Conversely you can edit `.yarnrc.yml` to enable `nodeLinker: node-modules` and see the success case


### System

```shell
Environment Info:

  System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 3.3.1 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 109.0.5414.119
    Safari: 15.5
```


### Additional context

_No response_