Macro triggering order


In my project we build a model and update the max(created_date) into another table where we record all running times and dates. I followed the following steps -

  1. Build model (select statement for table_1)
  2. In the config section of the model specify a macro for post_hook
  3. In the macro, insert into table_2.

My dbt compile failed as it checked the macro and complained table_1 didn’t exist.
So, I looked up the documentation and used

{%- set source_relation = adapter.get_relation(
        database=obj.database ,
        schema=obj.schema, -%}

    {% set table_exists=source_relation is not none  %}

    {% if table_exists %}

This did away with the error, but I realised that the initial run never inserts into table_2. Only the subsequent runs seem to bring records into this table.

My assumption was CREATE TABLE is a DDL and the post_hook triggers after it so finding the object in the db should be ok.
However, looking into the logs I realised the macro was being fired before the create table.
Can someone point out what I am missing? Is there a macro triggering order reference for dbt?