Current JUCE module is https://github.com/lv2-porting-project/JUCE.git which is version 6.0.8 from a particular JUCE fork
Elk OS SDK which is currently signaled as the only headless build is using https://github.com/elk-audio/JUCE/commits/mind/headless_plugin_client_next which is a fork of 5.4.5 and is fixing headless builds for VST3 only. Search for JUCE_AUDIOPROCESSOR_NO_GUI=1. Afaik these patches have never been merged in JUCE repo.
Back on built-in JUCE,
JUCE_AUDIOPROCESSOR_NO_GUI=1
is not producing any tangible effect and builds fails when including juce_gui_basics.h since
X11/Xlib.h: No such file or directory
the removal of this dependency is a key for embedding this plugin into already existing platforms like Mod Duo or any whatsoever headless platform