The answer to the question in the body of your post is no, for the reason that if $f' = g$ almost every where and $g$ is Riemann integrable and such that (*) holds, then $f'$ must be Riemann integrable. I sketch the proof below.
The fundamental theorem of calculus has the following slight strengthening (proof is almost the same as the classical case):
FTC1 Suppose $g$ is Riemann integrable on $[a,b]$ and $G(x) = \int_a^x g$. If $g$ is continuous at $x_0$, then $G$ is strongly differentiable at $x_0$.
Your hypothesis implies then $f$ is not only differentiable, but strongly differentiable at every point that $g$ is continuous. Note that by Lebesgue's criterion the set $\{g \text{ is cont.}\}$ is full measure.
Next, we have the standard characterization of strong differentiability:
Thm If $f$ is differentiable on an open set, then $f$ is strongly differentiable at $x$ if and only if $f'$ is continuous at $x$.
Together, this shows that $f'$ is continuous on a set of full measure, and hence necessarily $f'$ is Riemann integrable.
(Boundedness of $f'$ is not necessary for this argument.)
IIRC both results should be available somewhere in Schechter's Handbook of Analysis and its Foundations; I also have them in a set of not-yet-public lecture notes that I can share on request.
Let me write out the direct proof by unwrapping the results above.
Let $\Sigma$ be the subset of $(a,b)$ where $g$ is continuous. I claim that $f'$ is continuous at every point of $\Sigma$ too. The result then follows from Lebesgue's criterion.
Take $x\in \Sigma$
- For every $\epsilon > 0$, there exists $\delta > 0$ such that $|y-x| < \delta$ implies $|g(y) - g(x)| < \epsilon$.
- Hence for $w,z\in (x-\delta, x+\delta)$, we have
$$ |\int_w^z g - (z-w) g(x)| < \epsilon |z-w| $$
- Which we unwrap as
$$ \left|\frac{f(z) - f(w)}{z-w} - g(x)\right| < \epsilon $$
(Remark: this statement is basically the definition of strong differentiability, so steps 1-3 here gives the proof of FTC1 as described above the cut.)
- Take the limit $z\to w$, the LHS converges to $|f'(w) - g(x)|$. So we have proven that for every $\epsilon > 0$, there exists a $\delta > 0$ such that $|w-x| < \delta$ implies $|f'(w) - g(x)| \leq \epsilon$.
- This in particular implies that $f'(x) = g(x)$ and hence $f'$ is continuous at $x$.
(Remark: steps 4 and 5 can be used to reconstruct the proof of "strong differentiability implies continuity of derivatives" direction of the Thm mentioned above the cut, for one dimensional domains.)
Since $f$ is equal a.e. to $g$, $f$ is Lebesgue integrable. Now for $a < x < y < b$,
$$F(y) - F(x) = \int_x^y f(t)\; dt = \int_x^y g(t)\; dt$$
(see e.g. Rudin, Real and Complex Analysis, Theorem 8.21).
Thus $$(y-x) \inf_{[x,y]} g \le F(y) - F(x) \le (y - x) \sup_{[x,y]} g $$
and this implies that if $y \in [x,z]$ with $x < z$,
$$ \inf_{[x,z]} g \le f(y) \le \sup_{[x,z]} g$$
Consider a partition $\mathcal P$ of $[a,b]$ by $a = x_0 < x_1 < \ldots < x_n = b$
and the corresponding upper and lower sums $U(g;\mathcal P) = \sum_{i=1}^n
(x_i - x_{i-1}) \sup_{[x_{i-1},x_i]} g$ and $L(g;\mathcal P) = \sum_{i=1}^n
(x_i - x_{i-1}) \sup_{[x_{i-1},x_i]} g$. We have
$$L(g;\mathcal P) \le L(f, \mathcal P) \le U(f, \mathcal P) \le U(g, \mathcal P)$$
so the Riemann integrability of $g$ implies that of $f$.
Best Answer
Let $A$ be a measurable subset of $[0,1]$ such that both it and its complement have positive measure in every open interval in $[0,1]$ (see here for example). Its characteristic function is dominated by $1_{[0,1]}$, so it is Lebesgue integrable, but it is discontinuous everywhere on $[0,1]$ even after being modified on a null set, so it is not a.e. equal to a Riemann integrable function.