I was wondering if it's possible (and how frequent it is) to work my (math) PhD thesis in my home country if I am an international student?
That is probably possible, provided that your advisor approves. You will need to set up a communication channel with the advisor, of course. You will also need to make sure the all fees are paid for your degree. But many advisors will permit this. And, I hope, most universities.
I know of at least one such case, but here, the candidate had to make several trips between the US and UK to make it happen. The degree was awarded in UK. The student and advisor were also able to meet at international conferences in this case.
But communication is normally needed, so don't neglect that.
Most likely you would need to start in the country of the university and would almost certainly be required to return for the thesis defense. But the work itself can probably be carried out anywhere. A good local library might be a requirement, which would give you access to needed background papers.