Hello Jens,
Let’s try with your suggestion to use “Restrict Scope of Coding Rules” and see even if I believe it’s kind of advance feature that not a lot of SQ users are aware of.
I created the rule specification (https://jira.sonarsource.com/browse/RSPEC-5128) and its linked implementation ticket (https://jira.sonarsource.com/browse/SONARJAVA-3007) so you can push your PR.
Regards