Does the attached patch work around the macOS bug? (I don't use macOS so can't easily test this.) The idea of this patch is to fix both the new bug with file-directory-p and the circa-2012 bug with file-accessible-directory-p. The bug should probably be fixed in Gnulib so that Emacs proper is unaffected, but first I want to check whether this fix approach works.