Proper handling of watch with onlyif/unless

This fixes #16647