Forrest is mostly right, but the finer details are:
SQL Server can't parallelize modifications to table variables, which your function uses.
Prior to SQL Server 2017's Interleaved Execution, row estimates from table variablesMulti-Statement Table Valued Functions were very low.
One side effect of this is that plans were costed very poorly on the low end, and often wouldn't break cost threshold for parallelism.