Does the Einstein-Hilbert action only contain first derivatives of the metric? We tend to only use Lagrangians that are a function of at most the first derivative of the field $\mathcal{L} = \mathcal{L}(\phi, \partial_\mu \phi)$. For general relativity, this should not be any different, as the Einstein field equations are only of second order in the metric. However, naively one would think that the Lagrangian in the Einstein-Hilbert action contains second derivatives in the metric, because of the presence of the Ricci scalar. Why is this not an issue?
$$ \mathcal{L}_{EH}(g_{\mu\nu}, g_{\mu\nu,\alpha}, g_{\mu\nu,\alpha\beta}) = \sqrt{-g} R $$
If we perform the variation, it turns out not to matter. Writing the Lagrangian as $\sqrt{-g} g^{\mu\nu} R_{\mu\nu} $ the variation contains three terms (the first two of which do not contain any derivatives of the metric), hence
$$ \delta S = \int d^4x \left[ - \frac{1}{2} \sqrt{-g} g_{\mu\nu} R  \delta g^{\mu\nu} + \sqrt{-g} R_{\mu\nu} \delta g^{\mu\nu} + \sqrt{-g} g^{\mu\nu} \delta R_{\mu\nu} \right] $$ 
The first two terms combine into the Einstein tensor, leaving only a possibility of a problem in the last term. However, this emerges as a total derivative which we can ignore. Interestingly, the proof of this uses the Palatini identity which does not seem to hinge on the expression of the Christoffel symbols using derivatives of the metric, but only on their general properties as a connection.
So it seems we got lucky here, but is there a deeper reason this worked out?
 A: It's easier to demonstrate it in the first order formalism of gravity which involves both tetrad $e$ (which is sort of square root of metric $g \sim e^2$, see here for more explanation) and the spin connection $\omega$. It's worthwhile noting that the essence of the Palatini (alluded in OP) approach is to treat the metric and the (affine) connection as independent variables. To drive home the point: the key ingredient of the prove is to introduce an independent connection variable, being it spin connection or affine connection.
Now the details:
The gravity action can be heuristically (forgetting the minutia of Lorentz indices and outer-product between differential forms) written as 
$$
S \sim \int e^2(d\omega + \omega^2).
$$
The gravity equations can be obtained by varying the action with $e$ and $\omega$ independently. 
Varying with $e$ yields
$$
2e(d\omega + \omega^2) \sim T,
$$
where $T$ is the energy-momentum tensor. The spin connection $\omega$ is determined by varying the action with $\omega$ which in turn gives the zero torsion condition in case of zero spin current from fermions:
$$
de + e\omega =0.
$$
Therefore $\omega$ is the first derivative of $e$ and metric $g \sim e^2$
$$
\omega \sim de/e \sim dg/e^2.
$$
Substituting the above into
$$
2e(d\omega + \omega^2) \sim T
$$
shows that the gravity field equation comprises second order derivatives only.
To summarize: since we vary the gravity action with $e$ while holding $\omega$
constant, the gravity action $e^2(d\omega + \omega^2)$ and left hand side of the gravity field equation $2e(d\omega + \omega^2)$ share the same curvature R term
$$
R = d\omega + \omega^2,
$$
without further variation of curvature $R$ against metric. 
