Postgres CTE execution guarantees, inlining
Yes, this execution guaranteed . Postgres will not inline it in the way you mentioned.


  A useful property of WITH queries is that they are evaluated only once
  per execution of the parent query, even if they are referred to more
  than once by the parent query or sibling WITH queries. Thus, expensive
  calculations that are needed in multiple places can be placed within a
  WITH query to avoid redundant work. Another possible application is to
  prevent unwanted multiple evaluations of functions with side-effects.
   (from Postgres doc