You are making the solving of this issue a bit harder for us than is necessary.
Instead of showing the result of (I think)
Show the result of:
echo var_export($catsL, 1);
Then instead of showing the expected result using a completely different nomenclature ("item1")
item-1 / 2 / 0
item-1 / 3 / 2 - child of element with id 2
item-1 / 4 / 3 - child of element with id 3
Show us EXACTLY what you want - in the manner of the var_export() result, ie the exact makeup of the expected computed array.
There are many who can do this kind of modelling in their heads, but I am not one of them, I need a test case I can copy/paste and concrete result to which I can aim -- then I will have a go.
I don't think I am alone though, as your Q has gone unanswered in ~16hrs