This is exactly why I prefer the Arduino for the sprinkler system application over the Pi. The Pi comes with additional complexity which needs to be accounted for.
With that said, it likely won’t fit in the case if you try to use your own wiring. Does SSH stop working as well? If so, you might have an underlying issue causing the Pi/OS to lockup. If that’s the case, you can look into using a watchdog to reboot the Pi for you.