[layouts] improve tree manager to avoid moving a folder to same parent