There has been some work on this in nohang[0].
> Customizing victim selection: impact on the badness of processes via matching their names, cgroups, exe realpathes, environs, cmdlines and euids with specified regular expressions;
[0]: https://github.com/hakavlad/nohang