The query processor could not produce a query plan
You could consider raising a connect item (Microsoft bug report) as you have a reliable "repro", but then there are a number of workarounds for the problem - eg there is  no real need for the APPLY, eg

;WITH TableA
AS
    (
    SELECT 101 as A_ID
    ), TableB
AS
    (SELECT 1 as B_ID, 101 as B_A_ID , 'xxx' as B_Courses UNION ALL
    SELECT 2 , 101  , 'YYY'  UNION ALL
    SELECT 3 , 101  , 'ZZZ'  UNION ALL
    SELECT 4 , 102  , 'AAA' 
    )
SELECT
     a.A_id,
    (
    SELECT ',' + B_Courses
    FROM TableB AS B            
    WHERE B.B_A_ID  = A.A_ID          
    FOR XML PATH(''),TYPE
    ).value('.', 'VARCHAR(20)')
FROM TableA A


NB These errors will also be generating 20MB stack dumps (.mdmp) files to your Log directory.