Why is my recursive CTE so much slower on Azure SQL?
I checked your query again and it seems you can rewrite it this way:
WITH paths AS (
    SELECT Id, ParentId, Name AS [Path] FROM Folders
    WHERE Id = @FolderId

    UNION ALL

    SELECT f.Id, f.ParentId, f.Name  + '/' + [Path] FROM Folders f
    JOIN paths on paths.ParentId = f.Id
    )
SELECT @FolderId AS Id, [Path] from paths
WHERE ParentId IS NULL