The basic answer is usually when the doctor is confident the depression has gone and won't return if the medication is withdrawn. If this is not the case then anti-depressants can be continued on the basis that this will not actually do any harm. Moreover, anti-depressants of the SSRI type (the most commonly used) have many useful side-effects, because serotonin levels have effects throughout the body, not just within the brain; it is often not clearly understood why anti-dpressants benefit patients who aren;t depressed but who have other problems, but it is known that they do.
Serotonin syndome is rare, and is usually caused by high doses of one or more drugs.
Whatever the case, continuing an SSRI is unlikely to be harmful, and it is hard to judge the mental state of someone with dementia. Some SSRI's are also anti-anxiety drugs, without the drawbacks of what are commonly called "tranquilisers". Drugs like valium quickly lose their beneficial effects and have dependency issues
Regardless, any withdrawl of an anti-depressant must be done very gradually, under medical supervision. Suddenly stopping treatment can cause some very unpleasant side-effects.
As you note in your mum's case, the anti0depressan tis actually being used to help with her obssessional behaviors. As the root cause is organic damage to her brain due to the dementia mechanism, it is quite possible that withdrawing the drug would cause these to return.