It isn’t absolute. English is always evolving. What starts as two words may merge over time into a compound, or may not, or may exist in some grey area where either is acceptable. In the case of redshirt vs. red shirt, I think of the former as an individual concept, and the latter as a red individual concept. More specifically, the concept of a guy from Star Trek who gets regularly killed vs. a shirt that is red. But until a compound noun is widely understood and accepted, unless you’re getting graded on your writing, either would usually be acceptable. As a native speaker, I couldn’t even tell you if “hot dog” or “hotdog” is the more accepted spelling.
This is my mantra. Maintainability is king. I can’t convince anyone designing our systems that this is more important than fancy 3rd party libraries that add some capability that only a couple of people will ever understand how to use, but will find it’s way throughout the codebase and be a thorn in the side of bug fixes and new features for years.