okay the topic says about work done by the gravitational force and i assume that by "displace the small mass a very short distance dr, it will need an opposite equal force against the gravitational force" , the writer meant an equal external force acting on small mass which made dr displacement.
Yes if a equal external force as gravitational force act on a body it wont move as the total force on that body would be zero .
To compute work done by gravitational force the key idea is that we have to consider only the gravitational force . There may be other force acting on the body but those wont be counted for calculating the work by gravitational force.
For example , lets consider a boy is lifting a book of mass m. now , he is lifting it with F' force and F is the gravitational force . Surely, F'>F or he wont be able to lift the book. If he made a displacement dr then work done by him is W'=F'.dr
But the work done by the gravitational force is W"=F.dr=-mgdr
total work done on the book will be W=W"+W'=F'.dr-mgdr
So it can be seen that if we want to calculate the work done by gravitational field we can do this even if an external force is acting on the body.the external force must be grater or less than gravitational force or else no displacement will occur and hence there wont be any work done by any force.