The proper derivation of the centripetal acceleration—without assuming any kinematic variables are constant—requires a solid understanding of both the stationary Cartesian unit vectors $\hat{i}$ and $\hat{j}$ as well as the rotating polar unit vectors $\hat{e}r$ and $\hat{e}\theta$. The Cartesian unit vectors $\hat{i}$ and $\hat{j}$ are stationary and always aligned with the X and Y axes respectively, while the polar unit vectors $\hat{e}r$ and $\hat{e}\theta$ rotate with an angular velocity of $\omega=\|\dot{\theta}\|$ and point in the directions of increasing radius and angle (respectively). The included graphic below shows the two basis vector pairs overlaid on top of one another.
The position vector of the object is obviously defined as:
$\vec{p}(t)=x\hat{i}+y\hat{j}=rcos(\theta)\hat{i}+rsin(\theta)\hat{j}$,
with
$\|\vec{p}(t)\|=\sqrt{(rcos{\theta})^2+(rsin{\theta})^2}=\sqrt{r^2(sin^2(\theta)+cos^2(\theta))}=r\sqrt{(1)}=r$
Less obviously, it can be shown that the polar unit vectors $\hat{e}r$ and $\hat{e}\theta$ can be expressed solely in terms of the Cartesian unit vectors $\hat{i}$ and $\hat{j}$ and the angular position $\theta$ as,
$\boxed{\hat{e}r=cos(\theta)\hat{i}+sin(\theta)\hat{j}}$ and $\boxed{\hat{e}\theta=-sin(\theta)\hat{i}+cos(\theta)\hat{j}}$.
These two equations are extremely important, as they will be the key to expressing the Cartesian acceleration in polar coordinates, of which one of the terms will be our desired $v^2/r=\omega^2r$ centripetal acceleration. Moving forward, the vector acceleration of the object in Cartesian coordinates is simply
$\vec{a}(t)=\frac{d^2}{dt^2}\left[\vec{p}(t)\right]=\ddot{x}\hat{i}+\ddot{y}\hat{j}$.
Starting with $x=rcos(\theta)$ and $y=rsin(\theta)$ and differentiating once, we have
$\boxed{\dot{x}=\dot{r}cos(\theta)-r\dot{\theta}sin(\theta)}$ and $\boxed{\dot{y}=\dot{r}sin(\theta)+r\dot{\theta}cos(\theta)}$.
Differentiating again, we will have
$\ddot{x}=\ddot{r}cos(\theta)-\dot{r}\dot{\theta}sin(\theta)-\dot{r}\dot{\theta}sin(\theta)-r\frac{d}{dt}\left[\dot{\theta}sin(\theta)\right]$
$=\ddot{r}cos(\theta)-2\dot{r}\dot{\theta}sin(\theta)-r\left[\ddot{\theta}sin(\theta)+{\dot{\theta}}^2cos(\theta)\right]$, such that
$\boxed{\ddot{x}=(\ddot{r}-r\dot{\theta}^2)cos(\theta)+(r\ddot{\theta}+2\dot{r}\dot{\theta})(-sin(\theta))}$. 804