Garak was always
on the side of Cardassia, it just so happens, for a while, The Federation's goals lined up with "His Cardassia's" goals. I don't think that he believed he was working against Cardassia when opposing Dominion rule by aligning with The Federation, I believe he felt he was working for
Cardassia, just as Damar eventually did.
One Day I hope to be the Man my Cat thinks I am
Where are we going? And why are we in this Handbasket?