Partial answer to the question. this is not about recursion, but rather transitivity.
select itemID1, itemID2 from ((select itemID1, itemID2 from t ) union all (select itemID2, itemID1 from t ) ) t group by itemID1, itemID2
To get them as a list:
select itemID1, group_concat(distinct cast(itemID2 as varchar(32)) separator ',') from ((select itemID1, itemID2 from t ) union all (select itemID2, itemID1 from t ) ) t group by itemID1, itemID2
source share