I have noticed what looks to be an issue in the way the KML Layer's Folders are created for a very simple KML File. The structure of the source KML File is simple a placemark, and a SIBLING folder with three placemarks in it. However when added to the map, the resulting KML Layers folder structure places the sibling folder as a child folder within the first placemark's folder instead of at the same level as the first placemark's folder. Visually, that's fine. However, because we have the ability to turn layers on-and-off in our application, when we set the visibility of the first placemark using the KML Layer's setFolderVisibility method, then what is supposed to be the sibling folder is also turned on/off. In other words, because the sibling folder has been placed underneath the first placemark in the hierarchy, it's visibility becomes dependent on it.
You can use https://utility.arcgis.com/sharing/kml and paste the encoded contents of the attached KML file to see what I'm talking about with respect to the incorrect folder hierarchy it creates. If may helpul to use a JSON viewer to observe the results easily. I use Chrome's JSON Viewer Extension.
You can see it creates 3 folders (ids: 0, 1, 18). which is correct. Folder id 0 is the document itself. Folder 1 is the lone placemark. However, folder 18 is placed as a child of folder 1. This is incorrect. Folder 18 should be at the same level as folder 1 instead.
Attached is the KML. If you open it in Google earth, you can see the proper hierarchy.