I have seen hoc not agreeing with grammatical gender when it refers to a previous paragraph of actions. But I don't remember in what context.
Here is a made up example in English:
I once went to Jamaica. There, I swashbuckled with pirates, gambled with loansharks, and drank mead sailing on the high sea. This made me thirsty for another adventure.
Would the hoc corresponding to this be masculine, feminine, or neuter when describing all of these past deeds at once? Could I say "Hoc est causa" if I wanted to?