I think the question is confusing two different questions: What is pressure, and why does the atmospheric pressure or the pressure at some depth in the ocean have a particular value. These are not the same question, and the two things mentioned are the two answers to these two different questions.
Pressure is the net force per unit area on a surface caused by collisions of the particles in a fluid. Each time a particle hits a surface it's momentum normal to the surface is reversed imparting an impulse to the surface. The average impulse is determined by the average velocity which is determined by the average thermal energy which we call temperature. The frequency of the collisions per unit area is determined by the density of particles i.e. N/V and so from this description we arrive at the ideal gas law: P = R T N/V Pressure is "caused" by thermal energy of the particles.
At equilibrium if Pressure is pushing on a wall, and the wall is not moving, something must be pushing back. The equilibrium value of Pressure is always a case of another force balancing against Pressure and V or N or T changing until the forces are balanced.
Consider the statement "Pressure can exist if there is no weight". So we have a closed container floating in space containing a gas in equilibrium. Pressure pushes the walls out. What pushes the walls in? The inward force is the elastic restoring force of the walls. This is obvious if the container is a balloon. The walls stretch out. The elastic force increases as the balloon grows. Meanwhile the volume increases and the pressure drops. At some point the two forces balance and that is the equilibrium condition. The effect is less obvious in a heavy metal container because the walls barely move, but nevertheless that is exactly what happens. The elastic constant of the walls is just really really big. Another model is a container which is a piston and cylinder. If nothing holds the cylinder in, the pressure accelerates the cylinder and blows it out of the cylinder. If we imagine a spring holding in the piston in, the piston will move compressing the spring until the spring force holding the piston in equals the Pressure force pushing the piston out.
Now imagine a vertical cylinder the height of the atmosphere holding the same number of atoms as are normally found in that column of atmosphere. Place a weightless piston at some height in the cylinder. The pressure of the gas below the piston pushes the piston up. The gas above the piston pushes the piston down. At equilibrium the two forces are equal. We also know that at equilibrium the gas above the piston is not falling (in net). That gas only has two forces acting on it: gravity pulling down, and the cylinder pushing up. Since it is not accelerating those two forces are equal and AT EQUILIBRIUM the pressure up on the piston equals the weight of gas above the piston. The question was how does this happen. If the gas below the piston has too little pressure the piston will fall and compress the volume increasing the pressure until equilibrium is reached and the forces are balanced.
So, to answer the question directly, pressure is caused by the motion of particles, and with regards to gravity the fluid will compress until the forces of pressure and gravity balance at equilibrium. Gravity doesn't create pressure, but under gravity the pressure will arrive at an equilibrium value that balances against gravity.