Typically in hierarchical models, the variable $Z_i$ is taken to be some categorical variable that groups different observations, not a feature that varies between each and every individual. Taking the SAT example, one could reasonably take $Z_i$ to be the mean score of the school that student $i$ attended, since many students will attend the same school. Taking $Z_i$ as the individual skill level kinda defeats the purpose of using a hierarchical model, since this variable does not group your observations at all.
To make my point clearer, let us take the SAT example. We could use a model where students' scores are normally distributed around their school's mean score, that is:
$$X_i|Z_i\sim\mathcal N(Z_i,\sigma^2)$$
Then, to complete the hierarchical model, we say the schools' mean are normally distributed around a grand mean:
$$Z_i\sim\mathcal N(\mu,\alpha)$$
Now, one has to define priors for $\mu$, $\sigma^2$ and $\alpha$ and presto: the model is now fully specified.
The advantages of this approach include:
- When we predict a student's score, this allows us to take into consideration the school they come from.
- If a school has too few observations, this model automatically takes the distribution of the other schools' results into account when estimating the mean score for that school.
- this approach promotes shrinkage of the school means $Z_i$ to the overall mean $\mu$
If you use $Z_i$ to represent individual characteristics, such as skill level, you lose these advantages. Such a model would be perfectly valid and might be technically a hierarchical model, but a rather atypical one. (Unless you are considering each student takes the test more than once, then it would be a usual hierarchical model, since the variable "students" groups the variable "test score")
Now, suppose students $i$ and $j$ go to the same school (that is, $Z_i=Z_j$). Their SAT scores are dependent: if we learn $i$ got a good score, the probability of $Z_i$ being a good school increases and the expected score for $j$ increases. The only way we can make their scores independent is conditioning in their school's mean score, which you denoted as $x_i\perp x_j|\beta$.
This model does not suppose observations are iid - the observations are neither independent now identically distributed, i they have different values of $Z$. There is no contradiction in this, not all statistical models need iid assumptions. Most do, but not all.
You can find more info about hierarchical models and their implementation in PyMC3 in this link
Hope that was helpful!