I don't see how a cap could "discharge" through a panel in a destructive way. It's only a leakage current, so it's not gonna blow through there. Without a blocking diode, a panel has dark leakage that will drain the cap but the energy's insignificant, except the cap will be drained. A battery generally shouldn't damage the panel but the panel could drain the battery badly overnight.
You need to be careful about 4 things. One, a panel will produce much more than its rated voltage when there's no load... or, it's just charging a cap. You could exceed the cap's voltage rating.
Two, the cap needs to have a low enough ESR that the I*R voltage drop doesn't interfere with its operation. In fact, many "supercaps" have pathetically high ESR , tens of ohms even (or more), and probably wouldn't be able to drive a coil without massive paralleling.
Three, the solenoid's min holding current. See, a cap might hold "X" amount of joules to begin with, but that's not the important calc. The calc is that 1 amp out of a 1F capacitor creates a voltage change of -1V/sec. Well, coil current is kinda difficult to calculate since it has a resistance and inductance, and the current needed to hold it is much less than the current needed to initially actuate it.
Four, be SURE you have a fast flyback diode on that coil, or else the voltage spike as it turns off will kill your transistor.
I doubt there is any problem with higher voltage on the coil, as long as it's pulsed. For example, I doubt even 40v would do anything harmful to it at all, as long as it's pulsed. The danger would be in the V^2/R heating of the coil when left on for sustained periods, due to the squared term it's much higher for extra voltage. However, given that the power source is solar, there's not even a lot of wattage possible. If the switch were to fail and get stuck on, the solar panel would be unable to charge the cap and the solenoid will only see a small voltage and current.