This sounds close to a thing I've heard EAs argue for, though your version is missing important parts. A big one is that if the good the job allows you to do only
barely outweighs the moral harm you caused by taking taking the job, then probably there was some other job where you'd have caused much greater net moral benefit.
I think the closest there is to a mainstream EA view on this is https://80000hours.org/articles/harmful-career/ , which argues that "it's a mistake to pursue a career in which the direct effects of the work are seriously harmful, even if the overall benefits of that work seem greater than the harms".