# Assumptions on the variance of the null model in one-sample Z-test?

Apologies if the answer to this is obvious, but I can't understand why the usual interpretation of the p-value (probability under the null model of obtaining a test statistic at least as unlikely as the one observed) is valid in a simple one-sample z-test.

As an example, say have some data with mean 2 and std of the mean of 1, and we want to test if the data is greater than 0. This gives a z-score of 2, which we can look up in a table to obtain p=0.023. This corresponds to the shaded area below. What confuses me is that this seems to be the probability of drawing at most the mean of the null model (0) given a distribution inferred from the data (N(2, 1)), whereas the usual meaning of the p-value would be the probability of drawing at least 2 from a null model as illustrated below: I can see that these are the same if we assume the null model to have the same width as the distribution we obtain from the data. Is this just an assumption of the test, or is there some deep reason to expect this to be the case?

For $$a>0$$, \begin{align*} \mathbb{P}(N(a,1)<0) &= \mathbb{P}(N(0,1) + a <0) \\ &= \mathbb{P}(N(0,1)<-a) \\ &= \mathbb{P}(N(0,1)>a) \\ \end{align*}
The test statistic $$Z:= \sqrt{n} \frac{\bar{X}_n}{\hat{S}}$$ has distribution $$N(a\sqrt{n},1)$$.
However, for the test procedure it does not mean that the type I and type II errors are the same (i.e that $$P_{H_0}(H_1) = P_{H_1}(H_0)$$) in that the null will be rejected only if $$\mid Z \mid$$ is larger than $$q_{1-\alpha/2}$$ (for a fixed type I error $$\alpha$$) which might not be even close to $$a\sqrt{n}$$
For example if you take $$n=1$$ and $$X \sim N(2,1)$$ and $$\alpha = 0.05$$ ($$q_{1-\alpha/2}\approx 1.96$$) then $$\beta \approx 51\%$$