Filter rows if value exists in different columns
WITH cte AS (your query)
SELECT t1.*
FROM cte t1
WHERE NOT EXISTS ( SELECT NULL
                   FROM cte t2
                   WHERE t1.StockCode = t2.Component )


This works by wrapping your original query up into a CTE, then only returning rows from it if there are no other rows where the Component column is equal to the StockCode column.