How to rewrite slow CTE construction to match speed of temp tables
Sometimes CTE has got the wrong estimation. The temp table is good at it.
So, the CTE uses those indexes because they think fewer rows are there. The reason for the slowness of the first one is RID Lookup. If you drop your indexes or add your output column as include on your index. It will faster.
There is an awesome blog post here.
I think there is no win between them. You should use them to depends on the situation. And try them both in the same situation. In this way you can see the costs.