Photoelectric effect and work function

In a photoelectric effect we remove electrons from a metal using high energy photons, the work function is the minimal energy required for this effect.

My question is why doesnt the work fucntion depended on time? The more electrons we take out from the metal, the more ionized it becomes (if we remove a lot of negative charge, it will turn positive), and as a result we would expect to need more energy for this effect (the possitive charge of the metal would make it harder to remove the remaining electrons). Why does the work function remains constant no matter how much electrons we take out?

The more electrons we take out from the metal, the more ionized it becomes

Looking at an experimental setup description (such as this one or this one taken at random from google), you should find that the target is not electrically isolated. Indeed the potential of the target can be directly controlled to change the behavior of the experiment. Electrons return to the target via the circuit and there is no bulk charge accumulation.

The work function doesn't depend on time because we're assuming a $\textbf{steady state solution}$. This means the differential equations which describe the total charge on the surface of the metal are at an equilibrium, where all the time derivatives are $0$.

When you shine light on the metal, the system actually reaches this steady state almost instantaneously, just because the electric force is very strong compared to things you might experience in everyday life.