doesDirectoryExist also accepts symbolic links

This closes #7971

Signed-off-by: Austin Seipp <austin@well-typed.com>