Is it possible to differentiate $\sin x$ with respect to $\cos x$ from first principles?
You want to measure a change in $\sin{x}$ with respect to a change in $\cos{x}$. So you want $\sin{x}$ as a function of $\cos{x}$, which is not the same thing as $\sin(\cos{x})$. Therein is your fundamental issue.
What you want: if $x \in [0, \pi]$, then $\sin{x} = \sqrt{1 - \cos^2{x}}$, and so \begin{align*} \frac{d(\sin{x})}{d(\cos{x})} &= \lim_{h\to 0} \frac{\sqrt{1 - (\cos{x} + h)^2} - \sqrt{1 - \cos^2{x}}}{h} \\ &= \lim_{h\to 0} \frac{[1 - (\cos{x} + h)^2] - (1 - \cos^2{x})}{h(\sqrt{1 - (\cos x + h)^2} + \sqrt{1 - \cos^2{x}})} \\ &= \lim_{h\to 0} \frac{-h(h + 2\cos{x})}{h(\sqrt{1 - (\cos x + h)^2} + \sqrt{1 - \cos^2{x}})} \\ &= \frac{-2\cos{x}}{2\sqrt{1 - \cos^2{x}}} = -\frac{\cos{x}}{\sin{x}} = -\cot{x} \end{align*} as desired.
Exercise: what happens when $x \in [\pi, 2\pi]$?