So you are confusing many ideas here. Equilibrium is a tricky concept to define and in this case, it seems you have confused two different manifestations of it.
Consider a gas. Pressure can be defined everywhere in it through momentum flows and such, call this the kinetic pressure function for now. Now what is an equilibrium state? Well it happens that over time, this kinetic pressure function reduces to a constant throughout the gas (assuming no external forces and such) and then stops changing. Let’s call these constant pressure states equilibrium states. From a thermodynamic point of view, we can define another quantity $P$ as the derivative of internal energy to volume when external parameters are held constant. Call this the thermodynamic pressure for now. It is equal to that constant kinetic pressure approaches. Now the line you are looking for for your second question is this: For non-equilibrium states, there exists a kinetic pressure but no well-defined thermodynamic pressure. For equilibrium states, the kinetic pressure reduces to a constant which happens to be equal to the associated thermodynamic pressure. This stems from the fact that thermodynamics has no way to deal with these non-equilibrium pressure gradients. It doesn’t know or care. It only understands this single constant present in equilibrium states and sometimes this is perhaps ill-phrased as pressure being undefined for non-equilbrium states.
Now moving back to your first question of gravity. Well now, we need a stronger definition of equilibrium states because the kinetic pressure indeed does not reduce to a constant. Instead, it reduces to a linear function with known vertical gradient (namely $\rho g$). It's only characteristic value is say its value at the bottom of the container. For this system, my earlier statement about thermodynamic pressure completely falls apart. Changing volume at the top vs. bottom vs. sides all induce different changes in energy and hence various pressures to describe them reflective of the fact that we have a pressure gradient. This means our fundamental equation of state $dU=TdS-pdV$ has more parameters that need to be accounted for. Your book likely doesn't deal with such complex systems and uses the gravitational example as simply a side thought. When you look at processes, they likely look at the simple case of a regular gas in no gravitational field.
I know that was long but hopefully that answered your question!