I can see that as a defense against Ukraine destroying the plant, but I wouldn’t ever expect them to do that, as destroying a nuclear power plant in your own country is not the best of ideas.
So, why is it still sending electricity to Ukraine?
Also, does Ukraine pay Russia for that electricity?
At the end of the day, it comes down to their goals and what other countries will tolerate.
On the face of it, Russia, allegedly, claims to be interested in liberating the average Ukrainian citizen, not killing them all (Bucha etc. notwithstanding). If they started making cut and dry moves to shut down the entire country and cripple it, this goal is totally out the window and the optics shift from 'atrocious' to 'utterly indefensible'. Russia has allies that they have to keep feeling safe and secure, to ensure cooperation, trade, and thus guarantee their war machine.
More broadly, there is an agreed framework for how to 'ethically' wage a war and whilst they have violated a number of such rules, drawing universal ire from a unified international community by using any and all the means at their disposal to affect Ukraine, not distinguishing between civilians or soliders, is probably a step too far even for Russia.
Further, if Russia wants to use the power for itself they likely have some work to synchronise this power plant with their network that is running a different frequency from the Ukrainian one. There's no real way of knowing how much that work is because it will also depend on how many other generators and consumers they will connect on the way back to their national grid.