CTE vs Function/trigger performance in Postgresql
Running a big statement with its CTEs will be more efficient than running several small ones.

The only advantage of having a PL/pgSQL function for the individual inserts is that plans of statements are cached for the duration of the database session. But you can put your big statement into such a function if you want to make use of that.