Thanks to sid-cypher I now can use my favorite mutt with screwed up imap implementations such as one from yandex.ru. The trick to avoid forever “Login in…” is to set
set imap_pipeline_depth=0
for the particular account. And here it is – works as a charm!