I can reproduce the problem by starting a new, empty console application. It crashes without any changes after I select it to be a sandbox app.
I have looked at this (Sandbox activated macOS application crashes immediately after execution) thread and this (Receiving this error 'EXC_BREAKPOINT') one but neither seem to be related, or give any clues.
My crash log (attached) mentions "Unable to get bundle identifier for container id". I've added a Info.plist but it made no difference.
What is causing this?