It just occurred to me that none of the answers here, although they critique the “proof” and the "reasoning" given for why the proof is wrong, really answer the question as stated in the title: which is can we get a flawed “proof” from a function with integration no matter what the function? The “discontinuity” requirement has been shown to be superfluous, but the question I mention remains and is itself legitimate. So for a general function, can we rewrite its integral in such a way as to “prove” something false, using valid transformations of integrals but then a final fallacious (but seemingly "sensible") step?
While a thorough investigation of all integration techniques would seem to be difficult, we can investigate integration by parts. The integration by parts formula is
$$\int u\ dv = uv\ – \int v\ du$$
To get a fallacy of the form shown in the original post, we need that
$$\int u\ dv = -\int v\ du$$
which implies
$$u\ dv = -v\ du$$
or
$$u = -v \frac{du}{dv}$$
which is a differential equation for $u$ with solution $u = K/v$, where $K$ is a constant. Note that in the given example, $u = 1/x$, $dv = dx$, $v = x$, $du = -\frac{1}{x^2} dx$. Note that $1/v = 1/x = u$, so with $K = 1$ the condition is satisfied. Also, note that $uv = K$.
So for the case of integration by parts, any integrand $u dv$ where $u$ is a constant times the reciprocal of $v$ will work. We can take $u = x^2 + 1$, so that $v = \frac{1}{x^2 + 1}$, then $dv = -\frac{2x}{(x^2 + 1)^2} dx$, so the function to integrate is $-\frac{2x}{x^2 + 1}$. If you integrate that with $u = x^2 + 1$ and $dv = -\frac{2x}{(x^2 + 1)^2}$, you can get another fallacy of the form shown in the post.
Indeed, this shows that the answer to the question is in fact yes: Just write the function (“times” $dx$) as a product $u dv$ where $uv = K$. The condition $uv = K$ implies $u'v + uv' = 0$, or $v' = -\frac{u'}{u} v = -\frac{u'}{u} \frac{K}{u} = -K\frac{u'}{u^2}$. Thus $uv' = u \frac{dv}{dx} = -K \frac{u'}{u}$. Setting this equal to an arbitrary function $f$ gives $u(x) = Le^{\int -f(x)/K\ dx}$, $L$ another arbitrary constant. Now you have $u$ and $dv$ for any function you want and can "prove" something false from it.