Good idea, but I have a suggestion : Temporary tables are materialized, can have constraints and have metadata. But we do not use them. CTEs are not materialized, like a simple view, and I think could be in this case lighter than temporary table.
I have no time for the moment but it would be interesting to compare both solutions ? Regards, Nicolas