When a flake lives in a Git repository, Nix copies the repository into the store using Git's view of it. Untracked files are excluded. A newly created file referenced by the flake produces path ... does not exist or a missing-attribute error even though the file is plainly there on disk.
The fix is git add on the new file. Staging is enough; a commit is not required for a dirty working tree, because Nix uses the index plus tracked modifications. A file listed in .gitignore is likewise invisible, which surprises people who ignore build outputs and then reference one.
The error message does not mention Git, which is what makes this cost time. Confirm quickly with git status: anything under Untracked files is invisible to the flake. The same rule applies to nix build of a flake reference by path and to inputs sourced from local paths. Outside a Git repository the whole directory is copied and the rule does not apply, which is why the problem appears only after git init.