If the solar can power a smart plug, or smart relay, then you can still have the pump connected to it. Something like a Shelly smart relay might do the trick.
I use a solar powered ESP12F (low powered) with 18650 cell in a battery shield that can supply 3.3 and 5V with a 5V relay to turn on a submersible pump to water some outdoor plants in pots. My ESP is in deepsleep most of the time. Relay on for minute at a time with deep sleep stopped.
If you are running your fountain most of the time the ESP will need powered all day but can be put into deep sleep at night for most of time if you want to run it from a separate solar panel. Or you could just run it from the panel you are running for the pump but still with a battery for the ESP for stability.
I tell my relay to turn on the next time the ESP wakes by Qos1 and retain MQTT and it receives that the ESP is available (all in ESPhome. Relay for your purpose probably too much drain. The guys over at https://community.home-assistant.io/t/invitation-project-suggestion-an-automated-potted-plant/431846 use a transistor with flyback diode to turn their pump on off (much less power use).
I’m one of the guys Spiro mention. I too think the Transistor-approach could work. I also believe I read somewhere that pins retain their state during sleep. If I am right, you can deepsleep the ESP and keep the fountain on, keeping your power usage on a minimum. Don’t recall where, though, but I suppose it’s quite easy to test if I’m right.
The transistor you’ll need could be a IRLZ44N. You can even use it for PWM so you can control how high the fountain should be make make patterns or whatever.
Alternatives 1) you could use a servo to turn on power to fountain by a microswitch and send microcontroller to sleep and then wake it every 10 mins or so and when you want to power off fountain then tell microcontroller the next time it comes out of sleep to turn servo to turn off that micro switch. This youtube video gives you an idea of how it would work Servo to turn switch on.