extensions.c in the luatex source has
int synctexoption;
/*tex
A convenient primitive is provided: \.{\\synctex=1} in the input source file
enables synchronization whereas \.{\\synctex=0} disables it. Its memory
address is |synctex_code|. It is initialized by the {\sl Sync\TeX} controller
to the command-line option if given. The controller may filter some reserved
bits.
In order to give the {\sl Sync\TeX} controller read and write access to the
contents of the \.{\\synctex} primitive, we declare |synctexoffset|, such
that |mem[synctexoffset]| and \.{\\synctex} correspond to the same memory
storage. |synctexoffset| is initialized to the correct value when quite
everything is initialized.
*/
/tex Holds the true value of |synctex_code|: /
unlike say the primitive corresponding to shell-escape) it is not read-only and may be set locally.
\synctex=0will not stop the file from being included in the final synctex output. – user202729 Dec 11 '22 at 13:18