core.c: Perform orphan nodes adoption in structured order

First, adopt core node, then distribution nodes, then access nodes,
and finally consumer (ACM) nodes rather than in the same order
that the join requests were received (exact order on orphan list).

Signed-off-by: Ilya Nelkenbaum <ilyan@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>