It's actually a leftover from when I had to process the whole table at once. It's taking the GroupID value from the parent node and comparing it each child to prevent cyclic references. As you're using a single group, the query would have only needed an additional condition.
WITH CTE( groupID, objectType, memberID, [Nodelevel]) as
(
SELECT
tm.groupID
, tm.objectType
, tm.memberID
, 0 as [Nodelevel]
from #Hierarchy tm with(nolock) -- drop table #tblGrpsMatc
where groupID = 8
UNION ALL
SELECT
TC.groupID
,TC.objectType
, TC.memberID
, [Nodelevel] + 1 as [Nodelevel]
FROM CTE C2
inner join #Hierarchy TC with(nolock)
ON tc.groupID = C2.memberID
AND TC.groupID <> TC.memberID
WHERE TC.groupID <> 8
)
SELECT groupID, objectType, memberID, [Nodelevel]
FROM CTE;