**Describe the bug**

"Not found column ... in block" error, when join on alias column.

**How to reproduce**

```sql
CREATE TABLE a (
    id UInt32,
    value UInt32,
    id_alias UInt32 ALIAS id    
) ENGINE = MergeTree() ORDER BY id;

CREATE TABLE b (
    id UInt32,
    value UInt32
) ENGINE = MergeTree() ORDER BY id;

INSERT INTO a VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO b VALUES (1, 4), (2, 5), (3, 6);

SELECT * FROM a JOIN b ON a.id_alias = b.id;
```

**Expected behavior**

In version 21.5.9.4 result is:

id | value | b.id | b.value
-- | -------- | ----- | ----------
1 |  1 | 1 | 4 
2 | 2 | 2 | 5 
3 | 3 | 3 | 6 

**Error message and/or stacktrace**

In version 21.7.5.29 result is:
```
SQL Error [10]: ClickHouse exception, code: 10, host: 127.0.0.1, port: 14343; Code: 10, e.displayText() = DB::Exception: Not found column id_alias in block. There are only columns: id, value (version 21.7.5.29 (official build))
```
{
        auto & table_join_ast = join_ast->table_join->as<ASTTableJoin &>();
        if (table_join_ast.using_expression_list && result.metadata_snapshot)
            replaceAliasColumnsInQuery(table_join_ast.using_expression_list, result.metadata_snapshot->getColumns(), result.array_join_result_to_source, getContext());
        if (table_join_ast.on_expression && result.metadata_snapshot)
            replaceAliasColumnsInQuery(table_join_ast.on_expression, result.metadata_snapshot->getColumns(), result.array_join_result_to_source, getContext());
        collectJoinedColumns(*result.analyzed_join, table_join_ast, tables_with_columns, result.aliases);
    }
    result.aggregates = getAggregates(query, *select_query);
    result.window_function_asts = getWindowFunctions(query, *select_query);
    result.collectUsedColumns(query, true);
    result.required_source_columns_before_expanding_alias_columns = result.required_source_columns.getNames();
    
    bool is_initiator = getContext()->getClientInfo().distributed_depth == 0;
    if (settings.optimize_respect_aliases && result.metadata_snapshot && is_initiator)
    {
        
        if (replaceAliasColumnsInQuery(query, result.metadata_snapshot->getColumns(), result.array_join_result_to_source, getContext()))
        {
            result.aggregates = getAggregates(query, *select_query);
            result.window_function_asts = getWindowFunctions(query, *select_query);
            result.collectUsedColumns(query, true);
        }
    }
    result.ast_join = select_query->join();
    if (result.optimize_trivial_count)
        result.optimize_trivial_count = settings.optimize_trivial_count_query &&
            !select_query->groupBy() && !select_query->having() &&
            !select_query->sampleSize() && !select_query->sampleOffset() && !select_query->final() &&
            (tables_with_columns.size() < 2 || isLeft(result.analyzed_join->kind()));