According to documentation, in declarative pipelines "when-branch" directive can work only if used in multibranch pipelines. But if you use it in a non-multibranch pipeline it simply states "Stage ... skipped due to when conditional", and you think that the issue is in the condition and replay
It would be better if it says something like "You cannot use 'branch' in 'when' in non-multibranch pipeline" with some red font on job's console output.