OK, next thought - the function $f(\frac pq)=\frac1q$ and zero elsewhere. That's closer; it has limits of zero everywhere. But then each rational is a removable discontinuity, not a jump discontinuity. Closer, but still not it.
The next idea after that: let's build an increasing function with jumps at every rational. Let $g$ be an enumeration of the rationals; for each rational $r$, $g(r)$ is a different positive integer $n$. Then, define
$$f(x) = \sum_{r\in\mathbb{Q},r\le x}\frac1{g(r)^2+g(r)}$$
Since $\sum_n \frac1{n^2+n}$ converges (to $1$), that sum is finite for every $x$.
Choose some arbitrary $x$ and $\epsilon>0$. Let $n$ be such that $\epsilon\ge\frac1n$. There are only finitely many values $r_1,r_2,\dots,r_n$ with $g(r_i)\le n$. If we choose $\delta$ such that $(x,x+\delta)$ contains none of these $r_i$, then for $y\in (x,x+\delta)$,
$$f(y)-f(x)=\sum_{r\in\mathbb{Q},x<r\le y}\frac1{g(r)^2+g(r)} \le \sum_{j=n+1}^{\infty}\frac1{j^2+j}=\frac1{n+1}<\epsilon$$
From that, $\lim_{y\to x^+}f(y)=f(x)$ for all $x$. We have limits from the right.
For limits from the left, consider the variant function
$$f^*(x)=\sum_{r\in\mathbb{Q},r< x}\frac1{g(r)^2+g(r)}$$
This $f^*$ is equal to $f$ except at the rationals, where $f(r)-f^*(r)=\frac1{g(r)^2+g(r)}$. Again, choose arbitrary $x$ and $\epsilon>0$, and let $n$ be such that $\epsilon\ge \frac1n$. Find $\delta$ such that $(x-\delta,x)$ contains none of the $n$ points $r_i$ with $g(r_i)\le n$. Then, for $y\in (x-\delta,x)$,
$$f^*(x)-f(y) = \sum_{r\in\mathbb{Q},y\le r< x}\frac1{g(r)^2+g(r)} \le \sum_{j=n+1}^{\infty}\frac1{j^2+j}=\frac1{n+1}<\epsilon$$
From that, $\lim_{y\to x^-}f(y) = f^*(x)$ for all $x$, and we have limits from the left.
Of course, these limits $\lim_{y\to x^+}f(y)=f(x)$ and $\lim_{y\to x^-}f(y) = f^*(x)$ differ for every rational $x$, so there's a jump discontinuity at every rational.
With $f$ discontinuous at a dense set of points, it fails to be continuous on any interval, and can't be a piecewise continuous function. Done. We have our example.
I defined this as a function from $\mathbb{R}$ to $\mathbb{R}$, but it's easy to get a function on a smaller interval. Restricting $f$ works, as does using an enumeration of the rationals in that smaller interval.
Your approach seems honest but not correct. If two functions agree at a point $a$ and one of them is continuous at $a$ then it does not mean that the other is also continuous at $a$. Why?? Because continuity is not just about the behavior of a function at a point but about its behavior in some neighborhood of that point. When $f$ is continuous at $a$ and $g(a) =f(a) $ then you have information on behavior of $f$ in some neighborhood of $a$ but you have no information about behavior of $g$ at any point other than $a$.
Thus your argument does not work for the case when $f$ is continuous at $a$. Also you don't handle the case when $f$ is discontinuous at $a$.
Better approach is to deal with both cases simultaneously. Let $a$ be the point under consideration and let $\epsilon>0$ be given. Since $\lim_{x\to a} f(x) =g(a) $ it follows that there is a $\delta>0$ such that $$g(a) - \epsilon<f(x) <g(a) +\epsilon$$ for all $x$ with $0<|x-a|<\delta$. If $t\neq a$ is any number in $(a-\delta, a+\delta) $ then we can take limit of the above inequality as $x\to t$ and get $$g(a) - \epsilon \leq \lim_{x\to t} f(x) \leq g(a) +\epsilon$$ ie $$g(a) - \epsilon \leq g(t) \leq g(a) +\epsilon $$ for all $t$ with $t\neq a$ and $t\in(a-\delta, a+\delta) $ and the inequality trivially holds for $t=a$. This proves that $g$ is continuous at $a$. The job is done!!
Best Answer
This is a real nightmare, for university teachers. Every student of mine comes to my class from high school and is sure that $x \mapsto 1/x$ is discontinuous at $0$. The reason why calculus textbooks are so ambiguous is that their authors do not like to leave something undiscussed. For some reason, the answer to any question should be "yes" or "no"; hence they tend to formally state that functions are discontinuous outside their domain of definition.
In my opinion, this is a very bad approach: it is a matter of fact that discontinuous should not be read as the negative of continuous. The domain of definition makes a difference, and the most useful idea is that of continuous extension.
Almost any mathematician would say that the tangent function is continuous inside its own domain of definition.