When is it valid to use race/ethnicity in causal inference? It seems that often in social science, race is examined in causal terms, as researchers are interested in the differences between various ethnic groups in outcomes when controlling for other covariates. However, my understanding is that we actually can't use race for causal inference due to the omitted variable bias and the fact that essentially everything you control for is like a "post-treatment effect". 
So why do social scientists do this? Is it valid in certain contexts?
 A: There is nothing special about race when it comes to causal inference.  You can look for its effects just as you might look for the effect of the season.
The difficulty with a lot of causal models in the social sciences is mediation analysis: you want to know when A causes B directly, but not through C (What Ben means when he said direct versus indirect).  For example, in the causal model Gender, Hiring, Education, you want to know if Gender affects Hiring directly, but you concede that Gender might affect Education and we all expect Education to affect Hiring.  You cannot simply control for Education without opening back doors.  This pattern is ubiquitous.
There are approaches to tackling these problems, but as mentioned in Ben's answer, these are experimental changes.  For example, although you cannot control for Education without opening more back doors, you can freeze it by having the women use the men's resumes.
A: The idea that race can be a cause is not without dispute.
In a 1986 JASA article, Paul Holland discussed how he and Don Rubin coined the expression, “no causation without manipulation”.
The idea here is that causal inference requires a strict definition of a cause that identifies an intervention that hypothetically could be implemented -- even if that manipulation is not physically possible or ethically feasible.
So what is a hypothetical intervention that would change someone's race?  Perhaps a genetic manipulation?  But there is no "race" gene that can be flipped like a digital bit.  It is hard to imagine there is some way of changing all the genes that contribute to the phenotypes that define race, while keeping all other phenotypes constant.  Perhaps instead a cosmetic procedure could make a white person pass as black or vice versa?
Both of these lines of reasoning lead one to think about how race is defined by how other people perceive an individual.  So then is "race" what the researcher is looking for?  Perhaps it is racial discrimination?  Or a persons professed ethnic identity?  
If you talk to Miguel A. Hernán and James M. Robins, authors of the causal inference book cited below, they would tell you race is not a valid cause and that only thinking more deeply about what people actually mean when they talk about race as a cause will lead to better inferences.  
On the other hand, some, including Judea Pearl, take issue with position.
Here is a quote (from Twitter) by Hernan:

Pearl believes that any causal effect we can name must also exist. To
  him, the meaning of “the causal effect of A on death” is self-evident.
  He says we can quantify, say, the causal effect of race or the causal
  effect of obesity. I don't think we can.
We cannot estimate "the causal effect of obesity" because we don't
  know what that means. For the causal effect of A to be well defined,
  we need a common understanding of the interventions that we would use
  to change A. Otherwise, the effect is undefined.
If by now you are thinking that this is just another academic debate
  on the sex of the angels, think again: you beliefs about this issue
  determine your beliefs about the limits of science and about how to
  conduct data analyses.

Pearl addresses the issue here.
Hernán MA, Robins JM (2018). Causal Inference. Boca Raton: Chapman & Hall/CRC, forthcoming.” 
A: Race and ethnicity are variables that cannot be "controlled" in experiments, since it is not possible for the researcher to assign or change this characteristic of the study participant.$^\dagger$  For this reason, causal inference relating to race and ethnicity cannot generally rely on randomised controlled trials, and must instead fall back on uncontrolled observational studies.  As with other uncontrolled studies on any other topic, this comes with all the regular drawbacks and caveats on causal interpretation of results, including the possibility that there may be omitted "lurking variables" that affect analysis.  As a general principle, causal inference from uncontrolled studies is not reliable, and tends to be reasonable only in cases where the predictor in question is shown to have a statistical relationship conditional on a wide array of covariates, and tends to retain its predictive ability under variations in covariates that are not themselves intermediate causes.
Many studies in the social sciences include race/ethnicity as covariates, and the goal is to filter out these variables to find some other causal or statistical relationship.  There may be some studies where race/ethnicity is of direct interest as a predictor, and in this case the researcher needs to be careful to distinguish predictive efffects from causal effects, as in any uncontrolled observational study.  There is certainly no scientific problem with including race/ethnicity as variables in social science studies; the problems, if any, arise in regard to interpretation of results.  There is a good discussion of the causal interpretation of race variables in VanderWeele and Robinson (2014).
For the most part, all of this is just a matter of applying general statistical principles to a particular set of variables.  However, one issue that arises specifically in regard to causal inference regarding race and ethnicity is competing theories of whether any causality is direct (i.e., genetic/hereditary) or indirect (i.e., due to discrimination).  This aspect of the problem has been discussed at length by the economist Thomas Sowell in a series of books discussing statistical disparities among racial groups (see esp., Sowell 1975, Sowell 2013, Sowell 2018).  Sowell notes that historically, there was an excessive tendency to ascribe all racial disparities to genetic causes in the nineteenth and early twentieth centuries, and since the late twentieth century there is now an excessive tendency to ascribe all racial disparities to discrimination.  Both of these constitute a failure to properly apply statistical reasoning relating to causality, and both tend to occur due to a conflation of correlation and cause.  In any case, if you have not already read these works, they may give you a better understanding of the difficulties that arise in making causal inferences from statistical disparities among racial and ethnic groups.
It is difficult to answer your specific question without seeing a particular example of the kind of inference that concerns you.  There are a wide variety of cases where social science researchers "use race for causal inference" and the validity would depend on the nature of the data and the resulting inference.  (It is not even clear from that framing of the question whether race is the predictor of interest or just a covariate.)

$^\dagger$ Note that there are some randomised experiments where the appearance of race is controlled via some experimental mechanism.  For example, many studies on ethnic discrimination in employment use randomised 'correspondence tests' where the researchers control (and randomise) the markers of race and ethnicity in submitted job applications (see e.g., Zschirnt and Ruedin 2015).
