Running NIX_PATH="$sources::nixos-config=$PWD/configuration.nix" /nix/store/iakj2nchjqlxhrpgxnshlsqcg3rrw762-nixos-option/bin/nixos-option system.stateVersion, the value is actually set correctly.
But looking at the trace some more, it actually fails in the docs build. And those will not pick up the stateVersion from your config to allow the docs build be better cached.
Though, even then, I do not see where it could be getting the string context: