ClickHouse v.21.7.7.47

setting max_memory_usage doesnt work for 'create table .. as' queries

for example:
**this query works**
`create table test_table engine MergeTree order by a as
select a_table.a, b_table.b_arr
from (select arrayJoin(range(10000)) as a) a_table
         cross join (select range(10000) as b_arr) b_table
    settings max_memory_usage = 1;`

**this query doesnt work**
`insert into test_table
select a_table.a, b_table.b_arr
from (select arrayJoin(range(10000)) as a) a_table
         cross join (select range(10000) as b_arr) b_table
    settings max_memory_usage = 1;`
With error:
`DB::Exception: Memory limit (for query) exceeded: would use 4.09 MiB`

**Expected behavior**
**this query should NOT work, and setting max_memory_usage should work for all 'select'\'insert'\'create table' queries**
`create table test_table engine MergeTree order by a as
select a_table.a, b_table.b_arr
from (select arrayJoin(range(10000)) as a) a_table
         cross join (select range(10000) as b_arr) b_table
    settings max_memory_usage = 1;`
if (!internal && client_info.initial_query_start_time == 0)
    {
        client_info.initial_query_start_time = time_in_seconds(current_time);
        client_info.initial_query_start_time_microseconds = time_in_microseconds(current_time);
    }
#if !defined(ARCADIA_BUILD)
    assert(internal || CurrentThread::get().getQueryContext());
    assert(internal || CurrentThread::get().getQueryContext()->getCurrentQueryId() == CurrentThread::getQueryId());
#endif
    const Settings & settings = context->getSettingsRef();
    ASTPtr ast;
    const char * query_end;
    
    size_t max_query_size = 0;
    if (!internal) max_query_size = settings.max_query_size;
    String query_database;
    String query_table;
    try
    {
        ParserQuery parser(end);
        
        ast = parseQuery(parser, begin, end, "", max_query_size, settings.max_parser_depth);
        
        
        if (const auto * select_query = ast->as<ASTSelectQuery>())