Normally, for a small volume of liquid, the equilibrium of forces result in:
$$\sigma_b \Delta x \Delta y - \sigma_t \Delta x \Delta y = (\Delta m) g $$
where $\sigma_b$ is the normal stress below and $\sigma_t$ the normal stress from top.
Dividing by the volume $\Delta x \Delta y \Delta h$:
$$\frac{\Delta \sigma}{\Delta h} = -\rho g $$
When delta tends to zero:
$$\frac{\partial \sigma}{\partial h} = -\rho g $$
Integrating from $0$ (surface) to $h$ and considering that for a compression stress $\sigma = -p$:
$$p = \rho gh$$
It is only valid because there are no shear stresses in the volume element, as it is usual for a solid material for example. In the capillarity tube, the shear stresses can not be disregarded, and
$p = \rho gh$ doesn't apply.
What we can say is that at the surface of the container where the tube is located, and at the top of the tube, the pressure is atmospheric. So the column in the tube is compressed by the atmospheric pressure. Any small element of liquid in the tube is compressed, and has shear stresses. But it is not clear for me how to quantify all that stresses as a function of $h$.