In a way, it's just the compound that's the problem.
If the brakes are used hard and got some temperature in them, they don't have any sound, say on a track.
But light usage doesn't generate enough heat and they would squeak. A few repeated hard stops will generate the heat required to quiet them down but later after a few wear cycles it will come back.
My theory is that the compound has a rough edge once worn, and those are what make the noise. But with heat the pad became a bit malleable, 'flatten' so to speak and the pad surface changed to a flat surface and voila no noise. Once they are cool down, the flatten surface started to wear off and the peaks and valleys returns, pad surface became rough again and noise comes back.
--