The problem of inconsistent pointers to task team in the thread and team structures had been fixed by the commit r249711 (https://reviews.llvm.org/D13353).
Thus the debug assertion can safely be restored.
Tried the test provided in the https://reviews.llvm.org/D11269 which disabled the assertion. That test caused the assertion before r249711, and it work fine now. Not sure if we can add the test for regression testing because it only makes sense on a debug library.