doctor: fix check_for_broken_symlinks

Fixes #20000.