- Does "こうと思っていたことを思い出した" mean "I recalled an earlier thought"?
Yes. Just to clarify, こう is not a standalone word but is part of 行こう, the volitional form of 行く. Don't split a word like that. It's like saying just the "oing" part of "going".
- Does "前から" modify "と思っていた"?
Yes.
Here's a full translation:
元々は一日家でのんびりしようと思っていたけど、
I originally planned to relax at home all day, but
午後、~ことを思い出した
in the afternoon, I recalled that ~
前から時間があったら近くのお寺に引っ越しの挨拶をしに行こうと思っていた
I had been thinking (from before) about visiting a nearby temple to give a moving-in greeting when I had the time,
ので行きました。
so I went out (to the temple).