Even if you have a particularly strong moral code you may reasonably take the job as there is a higher degree of probability that you may affect change from the inside vs. the outside... and if that isn‘t possible you may try to go the snowden route...
It might be a little counter intuitive but in terms of jobs it is always good to exercise some counterfactual thinking: What would happen if I didn‘t take the job? Another dev without a strong moral code would likely simply do what they are told without thinking about consequences and long-term impact. Having loud voices within FB itself (hopefully in important positions) might have a big impact! Imagine Zuckerberg getting the low-down for all of his probably well-intentioned but horribly excetued ideas BEFORE they are rolled out...