This is after contributing for decades. For example in case of 2nd pillar the usual practice is: you can’t withdraw what was contributed less than 3 years ago and if you withdraw less than 3 years after making a voluntary contribution, the tax deductions from previous years are reversed. Considering that the 3rd pillar is of similar nature, more or less the same rules can apply.
We just have another discussion about it:
But this is not your case, because in case of people living in Switzerland long time you can argue that you withdraw money that were deposited long time ago while contributing new money in the same year.