Why can't nixos-rebuild see files that aren't in the git repository?

There’s the answer. Nothing to do with nixos-rebuild, it’s nix’s design.
When using flakes in a git repo, nix only copies files that are part of the git index to the store, so you must git-add any new files.