The technique of setting flags or markups in comments in the middle of code is actually somewhat common. One example I can give is in Java where the Netbeans IDE e.g. looks for certain error or warning suppression flags in the comments of every Class Object. This is because making these compiler/IDE/Framework specific tricks or features into a standard part of the language is difficult as the language specification has to be expanded to accommodate these features that can vary wildly and be highly specific to the needs of just a few persons. As we know, since languages are so broad, it takes more people coming together to decide the fate of such things, and the more people involved the longer it takes to decide on something.
If instead the special needs are accommodated by placing them in comments it does not break the main code since all other systems reading that code will simply ignore these comments, makes it compliant to standard specifications of the language, speeds up implementation since no one has to sit in committees, and only requires the specific devs working with or needing that specific feature/hook/whatever to learn the syntax. It’s a very useful thing to have, especially since a language’s or framework’s developers cannot see in to the future and predict every single way that their product will be used.