The pdf of a continuous random variable is given by:
$$ f_X(x) = 1/3,~ 0 < x < 1 $$ $$ f_X(x) = 2/3,~ 1 < x < 2 $$ $$ f_X(x) = 0,~ \text{otherwise} $$
My problem with this continuous random variable is that its density has jump discontinuities at $x = 0, x = 1$, and $x = 2$. I know that pdfs can be defined as piecewise functions, but from what I've seen so far (in the two probability courses I have taken at university and a variety of video lectures), pdfs defined as piecewise functions always have endpoints that meet, in order to form a continuous function.
Finally, the question I have is: is this a valid pdf?
Yes, this PDF is a valid density function. A random variable is considered to be continuous if its cumulative distribution function (CDF) is everywhere continuous. There is no other requirement; for example we don't require the density to be continuous.
Think of the uniform $[0,1]$ distribution. It is a continuous RV since its CDF $$ F(x):=\begin{cases} 0&x<0\\ x & 0\le x\le1\\ 1 & x>1\end{cases} $$ is continuous, yet its density has two jump discontinuities, at $x=0$ and $x=1$.
You can check that the CDF of the density you're looking at is similarly continuous. The CDF will be piecewise linear without jumps: $$ F(x):=\begin{cases} 0&x<0\\ \frac13x & 0\le x\le1\\\frac13 +\frac23(x-1)&1\le x\le2\\ 1 & x>2\end{cases} $$ and you can check that differentiating this $F$ will give the density you're looking at.