Inclusion of Firebase/Messaging pod causes all capacitor commands to fail

Im using Capacitor 6, firebase, and the push notification plugin to handle push notifs in my app. I’m following the guide here Push Notifications - Firebase | Capacitor Documentation and am able to get push notifications to work end to end on both Android and iOS when running the apps through android studio and xcode. My issue is that running any cap commands after adding the line pod 'Firebase/Messaging' to my podfile will result in this error:

Error: ENOTDIR: not a directory, open '<path>/ios/App/Pods/Headers/Private/Firebase/Firebase.h/package.json'

And the only way to resolve the issue is is to remove the offending firebase code, delete my pods folder & lock file and rerun cap sync . This issue doesn’t seem to happen on a fresh project with the same versions of capacitor and all plugins so there must be something specific with my configuration but the error is pretty unhelpful so I’d appreciate any advice on how to diagnose and fix.