**Does it reproduce on recent release?**
Reproduced on 21.11.1.1 (master) and 21.9.2
Works as expected on 21.8.2, so it's regression

**How to reproduce**
```
:) create table mt (id Int64, A Nullable(Int64), X Int64 materialized coalesce(A, -1)) engine=MergeTree order by id
:) insert into mt values (1, 42)  -- X will be 42 (as expected)
:) insert into mt select 1, 42    -- X will be -1
:) select *, X from mt order by id
┌─id─┬──A─┬──X─┐
│  1 │ 42 │ 42 │
└────┴────┴────┘
┌─id─┬──A─┬──X─┐
│  1 │ 42 │ -1 │
└────┴────┴────┘
```

**Expected behavior**

```
:) select *, X from mt order by id
┌─id─┬──A─┬──X─┐
│  1 │ 42 │ 42 │
└────┴────┴────┘
┌─id─┬──A─┬──X─┐
│  1 │ 42 │ 42 │
└────┴────┴────┘
```

{
    ASTPtr default_expr_list = std::make_shared<ASTExpressionList>();
    NameSet added_columns;
    for (const auto & column : required_columns)
        addDefaultRequiredExpressionsRecursively(block, column.name, column.type, columns, default_expr_list, added_columns, null_as_default);
    if (default_expr_list->children.empty())
        return nullptr;
    return default_expr_list;
}
ASTPtr convertRequiredExpressions(Block & block, const NamesAndTypesList & required_columns)
{
    ASTPtr conversion_expr_list = std::make_shared<ASTExpressionList>();
    for (const auto & required_column : required_columns)
    {
        if (!block.has(required_column.name))
            continue;
        auto column_in_block = block.getByName(required_column.name);
        if (column_in_block.type->equals(*required_column.type))
            continue;
        auto cast_func = makeASTFunction(
            "_CAST", std::make_shared<ASTIdentifier>(required_column.name), std::make_shared<ASTLiteral>(required_column.type->getName()));
        conversion_expr_list->children.emplace_back(setAlias(cast_func, required_column.name));
    }
    return conversion_expr_list;
}
ActionsDAGPtr createExpressions(