**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 │
└────┴────┴────┘
```

const Block & header,
    ASTPtr expr_list,
    bool save_unneeded_columns,
    const NamesAndTypesList & required_columns,
    ContextPtr context)
{
    if (!expr_list)
        return nullptr;
    auto syntax_result = TreeRewriter(context).analyze(expr_list, header.getNamesAndTypesList());
    auto expression_analyzer = ExpressionAnalyzer{expr_list, syntax_result, context};
    auto dag = std::make_shared<ActionsDAG>(header.getNamesAndTypesList());
    auto actions = expression_analyzer.getActionsDAG(true, !save_unneeded_columns);
    dag = ActionsDAG::merge(std::move(*dag), std::move(*actions));
    if (save_unneeded_columns)
    {
        dag->removeUnusedActions(required_columns.getNames());
        dag->addMaterializingOutputActions();
    }
    return dag;
}
}
void performRequiredConversions(Block & block, const NamesAndTypesList & required_columns, ContextPtr context)