Your example looks correct.
An easier example (at least notationally) seems to be: Let $R = \mathbb{Z}_3 \oplus \mathbb{Z}_3$. We see that $S = \{(0, 0), (1, 1), (2, 2)\}$ is a subring isomorphic to $\mathbb{Z}_3$, but $(1, 2)*(1, 1) = (1, 2)$, which is not an element of $S$, so it cannot be an ideal.
A much easier example (allowing the ring to be infinite): Try the ring (really a field) $\mathbb{Q}$ and the integers $\mathbb{Z}$. Clearly $\mathbb{Z}$ is a subring of $\mathbb{Q}$, but it is not an ideal of $\mathbb{Q}$ (which has only two ideals, $0$ and itself).
Of course I overlooked the simplest example: Let $R = \mathbb{Z}_2 \oplus \mathbb{Z}_2$ and take $S = \{(0, 0), (1, 1)\}$. Then $S$ is clearly a ring (as in the first example), while $(1, 0)*(1, 1) = (1, 0) \notin S$. This is your example is in the original post, just in a much easier to recognize form.
There exists a $C^{\infty}$ function $f$ such that $f(x)=1$ for all $x \in (-1,1)$ and $f(x)=0$ for $|x| >2$. [Construction of such functions using $e^{-1/x}$ is standard]. If you multiply this by $|x|$ you will go out of $C^{\infty}$.
Best Answer
It's not an ideal because it's not true that $rs \in S$ for every $r \in R$ and $s \in S$. In other words, if $s$ is a differentiable function, and $r$ is any general real-valued function, then $rs$ is not always differentiable. In general, it may not even be continuous!
For example, observe that $s = e^{x}$ is differentiable. Hence $s \in S$. However, let $$ r = \begin{cases} 1 & \text{if } x \in \mathbb{Q}\\ -1 & \text{if } x \not\in \mathbb{Q}. \end{cases} $$ Clearly $r \in R$ because it is a real-valued function. But note that $$ rs = \begin{cases} e^x & \text{if } x \in \mathbb{Q}\\ -e^x & \text{if } x \not\in \mathbb{Q}. \end{cases} $$ is not differentiable. In fact it's not even continuous. So $rs \not\in S$. Hence it is not true that $rs \in S$ for every $r \in R$, $s \in S$, so we see that $S$ is not an ideal of $R$.
However, it's clearly a subring since it's nonempty and the product and difference of differentiable functions is differentiable.