What you propose is technically possible, but probably not worth it. The major is problem is that generation must always equal load. Let's say you're using 300 watts, but your panels are generating 1kW. Where is that excess power going to go? You can't just turn off the sun. You would need something like a "dump load"--basically a giant resistor to turn the excess electricity into heat. You could turn this into a water pre-heater by immersing the resistor in a waterproof coating in a tank where incoming water can be pre-heated before it reaches your actual water heater. The electronics needed to do this kind of thing are called a charge controller, commonly used in off-grid installs.
Charge controllers typically work in conjunction with batteries, so you'll need one specifically for a battery-less install, if such a thing exists, or need to modify it accordingly.
Next, you need to modify the board to switch back to grid power when the panels aren't producing enough power (nighttime, cloudy day, high load, etc). Again, since charge controllers don't typically do this, you'll be looking for a very specialized piece of hardware, or need to make it yourself, with all the attendant dangers and liability issues involved with diy high-voltage electronics.
This is all going to be very complicated and probably not worth it compared to selling electricity back to the grid with a legit, aboveboard, permitted system. If you want to avoid that, the past of least resistance is to to use batteries to get through the night, not grid power.