Issue 13275 - Wrong di header generation on if and foreach statements

https://issues.dlang.org/show_bug.cgi?id=13275

Based on the refactoring PR #3860.