To understand this you need to consider the following things:
When you are bringing the positively charged rod near the electroscope, we express that electrons will gather near the charged rod leaving a net positive charge on the electroscope leaves, as you have shown in the diagram. This doesn't mean that there aren't any electrons on the ball, it actually means that there is a net negative charge on the ball due to attraction caused by bringing a rod which has a net positive charge (due to the deficit of free electrons). In all these cases, we are talking about only 'free electrons' and not the electrons that are orbiting in the inner shells around the nucleus.
The amount of polarization of charge that will happen on the electroscope will depend on how much net positive charge does the rod contain. A rod with charge $q_1$ will cause more electrons to get accumulated on the ball as oppose to $q_2$ charge, where $q_1>q_2$. Now, why does this polarization of charges on the electroscope stops, why doesn't all the free-electron get accumulated on the ball leaving the leaves of the electroscope completely deficient in electrons? Well, that is because, while net free electrons increase on the ball they also create a net positive charge on the electroscope leaves (due to the absence of electrons). So, in a way you reach a state of equilibrium when a certain amount of net negative charge is existing on the ball.
By grounding the ball of the electroscope now you are disturbing this balance. The act of grounding the ball is enabling more free electrons to get accumulated (these extra free electrons come from the Earth's surface) thereby reducing the amount of polarization. As an effect, you will observe that the leaves of the electroscope will move slightly closer at the instance you ground the ball.
Now, coming to your query, are those free electron, which were originally present on the ball before grounding, not repelling the free electrons moving up from the Earth's surface? Well, yes, they are. And that's the precise reason why a further re-distribution of charges happen causing the lowering of leaves by a small amount, as the net positive charge on the leaves also reduces.
We generally imagine a static picture, but in the actual case, the free electrons are not stationary in the metal. They are constantly drifting, it is just that at a given instance the net charge on the ball would be more negative. I hope this helps in clarifying your query.