Fixes for race conditions
From the main commit:
At the time of monitoring a folder, we first crawl its contents and then add a monitor. This has a brief window in which a file might be added at the right time that crawling is too late, but the monitor wasn't added yet. Invert the order here, so we first set up the monitor and then crawl the file. There is still a race condition in that the file might be now reported twice (once via crawling, once caught by the monitor). Those should be already coalesced by the upper layers, so it is preferable to have the race condition on this side. Fixes some of the timeout situations in tests, as the way they create directories and folders with almost no time in between may tickle these situations.
This is likely one of the sources for some of the weird things we were seeing on CI.