I keep all of my source code files and header files together in groups in the project folder. I can delete them from the project and then drag them back into the project. They will appear in the project navigator but they won't build. Spurious error: Expected identifier or '(' in the headers and the analyzer thinks that the header file is not a member of any targets in the current scheme that build for analyzing. I tried to add some headers individually and check the target box to force XCode to include them in my project but as you say, you can't and shouldn't do this.
I didn't change the inclusion of any .h .c or .m files. These are in the project folder. Adding them using the several options won't fix this. On June 15th I moved an NSTextField in a .xib a few pixels. When I built the project it and all of my projects stopped working on three versions of XCode and two Macs - Intel and Apple Silicon. XCBBuildService - a component of XCode crashed at this time. On the new M1 iMac this is not happening.
To verify that it isn't the project files, I created a new project (several times) and started adding files, carefully following the directions in the XCode documentation. Of course the documentation is inaccurate, for example I couldn't add some illustrations to the project without putting it in a workspace. They won't build. I'll study your post and see if I've missed anything.