Hi and thanks in advance.
When $\tan x = \frac{(2x + 1)\pi}{2}$, the function is undefined, resulting in a period of simply $\pi$. However, $\csc$ and $\sec$ also include undefined points. Taking this discontinuity into account, why are their periods $2\pi$ instead of $\pi$?

The period of $\csc x$ is $2\pi$ because the period of $\sin x$ is $2\pi$, and $\csc x = \frac{1}{\sin x}$. It doesn't have to do with the discontinuity. The same thing holds for $\sec x$.
The period of $\tan x$ is the outlier here. Note that $\sin (x + \pi) = -\sin x$, and similarly, $\cos (x + \pi) = -\cos x $. So, after a rotation of $\pi$, neither $\sin x$ nor $\cos x$ has returned to its starting point. But, here's what happens to tangent:
$$ \tan (x+\pi) = \frac{\sin (x + \pi)}{\cos (x + \pi)} = \frac{-\sin x}{-\cos x} = \frac{\sin x}{\cos x} = \tan x . $$
The same thing happens with $\cot x$. So, while most trig functions have a period of $2\pi$, $\tan x$ and $\cot x$ have a period of $\pi$.