Short answer
One reason why we assume/require i.i.d. data is that it simplifies the computations. More specifically, if we assume the samples to be i.i.d., their joint probability is then simplified to a product of marginal probabilities.
Long answer
In a dataset $D$, suppose we have $n$ samples. We define their joint probability (i.e. the probability of these samples occurring at the same time) as follows
$$P(z_1, z_2, \dots, z_n) \tag{1}\label{1}$$
For instance, if each $z_i$ is binary (i.e. can take one of two values, e.g. $0$ or $1$). Then, to define the probability distribution over all possible values of all $z_i$, we need to compute $2^n$ probabilities (which corresponds to all combinations of the values of all $z_i$s).
More importantly, if the samples are correlated, this probability must be calculated as a product of conditional probabilities (by definition).
However, if the samples are i.i.d., then the join probability in equation (\ref{1}) can be computed as a product of marginal probabilities
$$P(z_1, \dots, z_n)=\prod_{i}P(z_i) \tag{2}\label{2}$$
which may be simpler than calculating with conditional probabilities because marginal probabilities may be simpler to compute.
Example: binary cross-entropy
In the case of a binary classification problem, we assume to have a labelled dataset $D = \{(x_i, y_i) \}$, where $y_i$ would be the binary label ($0$ or $1$) for the corresponding input $x_i$. So, we could define our likelihood function parametrized by the parameters $w$ as follows
$$\ell(w) = P(y_1, y_2, \dots, y_n \mid x_1, x_2, \dots, x_n; w) \tag{3}\label{3}$$
If we assume $(x_i, y_i)$ to be independent of $(x_i, y_j)$, for all $i \neq j$, then this joint probability (\ref{3}) of labels given the inputs can also be written as a product of the marginals of the labels given the inputs.
$$\ell(w) = \prod_i P(y_i \mid x_i; w) \tag{4}\label{4}$$
For numerical stability (because sums are more stable than products of small numbers), rather than considering the likelihood, we can consider the log-likelihood, which is just the logarithm of $\ell$. However, this transforms the product in (\ref{4}) into a sum (note that this is just a rule of logarithms!).
$$\log \ell(w) = \sum_i \log P(y_i \mid x_i; w) \tag{5}\label{5}$$
We can also do this because the logarithm is a strictly increasing function, so the maxima/minima of $\ell$ are attained at the same parameters as the maxima/minima of $\log \ell$.
So, now, the goal is to find the parameters $w$ of the log-likelihood such that the probability of the samples is maximized. Equivalently, rather than maximizing the log-likelihood, we can minimize its negative (this is what is usually done in practice!), which leads to what people call the cross-entropy function (which is just the negative log-likelihood).
$$\text{CE}(w) = - \log \ell(w)$$
So, minimizing the cross-entropy $\text{CE}(w)$ is exactly the same thing as maximizing the $\log \ell(w)$.
Given that the labels $y_i$ are binary, we can assume that $P(y_i \mid x_i; w)$ in (\ref{5}) is a Bernoulli distribution, so we could define the probability that the label is equal to $1$ (or $0$, it's the equivalent) as follows
$$P(y_i=1 \mid x_i; w)=\hat{p}^{y_i} (1-\hat{p})^{(1-{y_i})},$$
where $\hat{p}$ is the output of the neural network $f(x_i; w) = \hat{p}$ when fed with $x_i$, and $\hat{p}$ is just an estimate of the parameter $p$ of the Bernoulli distribution we try to learn.
So, now, our cross-entropy $\text{CE}(w)$ can be written as follows
$$\text{CE}(w) = \sum_i \log \left( \hat{p}^{y_i} (1-\hat{p})^{(1-y_i)} \right) $$
So, now, we just need to estimate $w$ to produce $\hat{p}$. So, basically, we have avoided the computation of conditional probabilities of the labels.