Sort repro:

```sql

CREATE TABLE a ( `id` String, `color` String, `section` String, `description` String) ENGINE = MergeTree ORDER BY tuple()

CREATE TABLE b ( `key` String, `id` String, `color` String, `section` String, `description` String) ENGINE = Join(ANY, LEFT, key)
CREATE MATERIALIZED VIEW c TO `b` AS SELECT concat(id, '_', color) AS key, * FROM a
INSERT INTO a VALUES ('sku_0001','black','women','nice shirt')
```

Versions:
* 21.10.4.26 OK
* 21.11.2.2: KO
* 21.11.5.33: KO
* 21.12.1.9879 (Today's master): KO


Backtrace:

* 21.11:

```
2021.12.03 16:12:25.250703 [ 764841 ] {e404297a-1a02-46ef-9526-b6b9865f5c61} <Error> TCPHandler: Code: 49. DB::Exception: Context has expired: while pushing to view d2.c (44692c40-db1f-4541-8469-2c40db1f0541). (LOGICAL_ERROR), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0x9b66fd4 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
1. DB::WithContextImpl<std::__1::shared_ptr<DB::Context const> >::getContext() const @ 0xc4aca06 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
2. DB::SetOrJoinSink::consume(DB::Chunk) @ 0x12b37d36 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
3. DB::SinkToStorage::transform(DB::Chunk&) @ 0x13326044 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
4. ? @ 0x132a6649 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
5. DB::ExceptionKeepingTransform::work() @ 0x132a613c in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
6. ? @ 0x131348bb in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
7. DB::PipelineExecutor::executeStepImpl(unsigned long, unsigned long, std::__1::atomic<bool>*) @ 0x13130871 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
8. DB::PipelineExecutor::executeStep(std::__1::atomic<bool>*) @ 0x1312f085 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
9. DB::TCPHandler::processInsertQuery() @ 0x130d5e46 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
10. DB::TCPHandler::runImpl() @ 0x130ce9b7 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
11. DB::TCPHandler::run() @ 0x130e2239 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
12. Poco::Net::TCPServerConnection::start() @ 0x15d1d16f in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
13. Poco::Net::TCPServerDispatcher::run() @ 0x15d1f561 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
14. Poco::PooledThread::run() @ 0x15e33f09 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
15. Poco::ThreadImpl::runnableEntry(void*) @ 0x15e31640 in /mnt/ch/official_binaries/clickhouse-common-static-21.11.2.2/usr/bin/clickhouse
16. start_thread @ 0x9259 in /usr/lib/libpthread-2.33.so
17. __GI___clone @ 0xfe5e3 in /usr/lib/libc-2.33.so
```

Master:
```
2021.12.03 16:14:15.653601 [ 766370 ] {f1b6b8e4-5c94-40cd-b26a-11b438e15c0a} <Error> TCPHandler: Code: 49. DB::Exception: Context has expired: while pushing to view d4.c (1618345e-1662-44e4-9618-345e166274e4). (LOGICAL_ERROR), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xa217b1a in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
1. DB::WithContextImpl<std::__1::shared_ptr<DB::Context const> >::getContext() const @ 0xcc2a046 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
2. DB::SetOrJoinSink::consume(DB::Chunk) @ 0x138503f6 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
3. DB::SinkToStorage::transform(DB::Chunk&) @ 0x141f477d in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
4. ? @ 0x14172309 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
5. DB::ExceptionKeepingTransform::work() @ 0x14171dfc in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
6. DB::ExecutionThreadContext::executeTask() @ 0x14003dc3 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
7. DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) @ 0x13ff806f in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
8. DB::PipelineExecutor::executeStep(std::__1::atomic<bool>*) @ 0x13ff7de0 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
9. DB::TCPHandler::processInsertQuery() @ 0x13fa0720 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
10. DB::TCPHandler::runImpl() @ 0x13f999dd in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
11. DB::TCPHandler::run() @ 0x13fad019 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
12. Poco::Net::TCPServerConnection::start() @ 0x16efeccf in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
13. Poco::Net::TCPServerDispatcher::run() @ 0x16f01121 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
14. Poco::PooledThread::run() @ 0x1700fea9 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
15. Poco::ThreadImpl::runnableEntry(void*) @ 0x1700d5a0 in /mnt/ch/official_binaries/clickhouse-common-static-21.12.1.9879/usr/bin/clickhouse
16. ? @ 0x7f1b42c8b259 in ?
17. clone @ 0x7f1b42bb45e3 in ?
```

Note that in a longer repro (with multiple MV writting to multiple join tables) I've also gotten a `UNKNOWN_TABLE` eventhough the table exists and it's available. 
const StoragePtr & table,
    const StorageMetadataPtr & metadata_snapshot,
    const Names & columns,
    ThreadStatus * thread_status,
    std::atomic_uint64_t * elapsed_counter_ms)
{
    auto sample = getSampleBlock(columns, table, metadata_snapshot);
    return buildChainImpl(table, metadata_snapshot, std::move(sample) , thread_status, elapsed_counter_ms);
}
Chain InterpreterInsertQuery::buildChainImpl(