Automatic turn off of water pump as water tank overflows (Manual turn on is needed)
What you ask is out there, in the form of residential effluence treatment (septic).

It utilizes float switches and a small analog or digital controller that automates exactly what your looking for.

Research "septic pump tank design". You're looking for a system with 3 or 4 float switches installed. Parts for these systems are available all over the world.