directory: Avoid setting up unnecessary monitors
Generally, we setup 1 monitor for the current view directory. There have been many requests in the past to setup monitors for subdirectories (in order to keep directory file counts up to date), but nautilus has resisted those requests for performance reasons and out of concern regarding inotify limits.
Despite this, we have actually been setting up many more monitors than we realized for NautilusStarredDirectory and NautilusSearchDirectory. Those custom folders contain files/folders that can be from a range of different parents. Each call to file_monitor_add ends up creating a monitor for that file/folder's parent. Ironically, commit b32d6453 ("Only use directory monitors to avoid using lots and lots of file monitors") intended to reduce the number of monitors, but these custom directories didn't exist at that time (SearchDirectory came 3 months later and StarredDirectory came over a decade after that).
Add a check to only monitor the directory when the call was specically to nautilus_directory_file_monitor_add().