Consider $$f(x)=\arctan\left(\cos\left(\alpha\right)\tan\left(x\right)\right)$$ where $0<\alpha<\frac{\pi}{2}$ is a constant.
https://www.desmos.com/calculator/fdbfk2gh5f
Why is $x=\frac{\pi}{2}$ defined, and why does $f(\frac{\pi}{2})$ not change as $\alpha$ is changed?

The function is not defined in $x=\pi/2$. What exists are the limits:
$$\lim_{x\to\pi/2-0}f(x)=\lim_{x\to\pi/2-0}\arctan(\cos(\alpha)\tan(x))=\pi/2$$
because $\tan(x)\to+\infty$, so $\cos(\alpha)\tan(x)\to+\infty$ and $\arctan(\cos(\alpha)\tan(x))\to\pi/2$ when $x\to\pi/2-0$,
and
$$\lim_{x\to\pi/2+0}f(x)=\lim_{x\to\pi/2+0}\arctan(\cos(\alpha)\tan(x))=-\pi/2$$
because $\tan(x)\to-\infty$, so $\cos(\alpha)\tan(x)\to-\infty$ and $\arctan(\cos(\alpha)\tan(x))\to-\pi/2$ when $x\to\pi/2+0$.