Check if variable exists in pipeline variables gui

I have a pipeline that triggers pipelines. It uses some variables for the triggered pipelines. I want to deactivate a stage when i delete a variable in the gui of the pipeline variables. I tried rules with exists,

  • if $myvar != null
    when: always
  • when: never
    and shell scripts that also dont work.
    The variables have defaultvalues and after deletion in the ui, the default values are still intact.