I have now tested the squirrel script and it works! It can be enabled by adding it in <ExtraCommands> outside all build targets, so it always happens, regardless of which build target is active:
<ExtraCommands>
<Add before="[[ GetProjectManager().SaveAllProjects(); ]]" />
</ExtraCommands>
This obviously saves all projects in a workspace, so it does not make sense to add this in every project in a workspace, and it would be cumbersome too. I have several workspaces with quite a few projects, so I found that I can instead create a dummy "Prebuild" project in such workspaces and let it do nothing except run the above squirrel script in its own prebuild step. The other projects can then depend on that Prebuild project. All project files in the workspace are then always saved before every build and the setting for this is in one place.
Still a work-around, but quite a nice one. It fixes the issue with project files not being checked in to source control.