File tree expand/collapse tree state fixes

Fixes:

* #9269 
* #9276 
* unreported case where expanded subdirectory causes parent to not fully load

cc @ingorichter