It’s to ensure that Nix can obtain the metadata of a flake (such as its inputs) without having to execute a Turing-complete program that may not terminate. That is, a command like nix flake info should finish in some bounded amount of time.
The alternative was to put the metadata in a separate json/toml file but that seemed inconvenient to me.
This restriction could be lifted/relaxed in the future.