so yes it is possible to detect those patterns and ban them as unsafe, and have a"safety checked alternative. clr does this currently:
https://github.com/ityonemo/clr#safety-oriented-architecture