  We introduce a cohomology theory of $n$-ary self-distributive objects in the
tensor category of vector spaces that classifies their infinitesimal
deformations. For $n$-ary self-distributive objects obtained from $n$-Lie
algebras we show that ($n$-ary) Lie cohomology naturally injects in the
self-distributive cohomology and we prove, under mild additional assumptions,
that the map is an isomorphism of second cohomology groups. This shows that the
self-distribuitve deformations are completely classified by the deformations of
the Lie bracket. This theory has important applications in the study of
Yang-Baxter operators as the self-distributive deformations determine
nontrivial deformations of the Yang-Baxter operators derived from $n$-ary
self-distributive structures. In particular, we show that there is a
homomorphism from the second self-distributive cohomology to the second
cohomology of the associated Yang-Baxter operator. Moreover, we prove that when
the self-distributive structure is induced by a Lie algebra with trivial
center, we get a monomorphism. We construct a deformation theory based on
simultaneous deformations, where both the coalgebra and self-distributive
structures are deformed simultaneously. We show that when the Lie algebra has
nontrivial cohomology (e.g. for semi-simple Lie algebras) the simultaneous
deformations might still be nontrivial, producing corresponding Yang-Baxter
operator deformations. We provide examples and computations in low dimensions,
and we completely characterize $2$-cocycles for the self-distributive objects
obtained from all the nontrivial real Lie algebras of dimension $3$, i.e. the
Bianchi I-IX, and all the nontrivial complex Lie algebras of dimension $3$.
