Doubt in the concept of Upthrust and Buoyancy

First of all, we know that $P = hρg$ for any depth h in a liquid. While deriving this formula we use (mg + P1A) - P2A = 0, where P1 and P2 are pressures on the upper and lower surfaces respectively. That being good, we get the relation P = hρg.

Now as pressure depends on h, the pressure on the lower side must be greater than the pressure on the upper side, and so should the forces (as area of cross section is same.) Therefore from here we get the idea of a greater upward force called upthrust. However, the definition of buoyant force is that it is the net upward force (excluding gravity) which means we do not consider mg (weight of the cylinder.) But now as we do not consider gravity, the relation P = hρg becomes invalid! I get the intuitive idea of an upthrust but the excluding gravity part is what i dont get. Have I misinterpreted the meaning of excluding gravity?

You definitely must consider the effect of gravity on the fluid, otherwise (as you implied), there would be no pressure gradient (as per $P = h \rho g$), and no buoyant force.