If I manually fix the version, the builds succeed, but the next cap sync sets it back to 3.
I think that your Podfile's post_install is trying to fix this - but it doesn't seem to work.
In fact searching the node_modules directory in my project, that post_install doesn't seem to have made it into the package.
This is somewhat beyond my understanding of Pods and capacitor plugins - but it would be great to get a solid fix. Maybe using a different library? Or a newer build of SwiftSockets - the latest version does seem to use Swift v5, but hasn't been published...
For now, I'm just adding an npm run sync command that runs npx cap sync and then fixes the SWIFT_VERSION.