with first_cte as (
select *
from a_table
where 1=1
),
second_cte as (
select
column_1,
column_2,
column_3
from b_table b
inner join first_cte f on f.user_id = b.user_id
where 1=1)
select * from second_cte
In theory you could do something like this. Although it is not direclty possible now to execute the inner block of second_cte in dataGrip because you will have the same problem of first_cte not being known, there is a plugin you could use for that, i discovered when i had this problem.
https://plugins.jetbrains.com/plugin/27835-ctexecutor