Being fascinated by the approximation $$\sin(x) \simeq \frac{16 (\pi -x) x}{5 \pi ^2-4 (\pi -x) x}\qquad (0\leq x\leq\pi)$$ proposed, more than 1400 years ago by Mahabhaskariya of Bhaskara I (a seventh-century Indian mathematician) (see here), I considered the function $$\sin \left(\frac{1}{2} \left(\pi -\sqrt{\pi ^2-4 y}\right)\right)$$ which I expanded as a Taylor series around $y=0$. This gives $$\sin \left(\frac{1}{2} \left(\pi -\sqrt{\pi ^2-4 y}\right)\right)=\frac{y}{\pi }+\frac{y^2}{\pi ^3}+\left(\frac{2}{\pi ^5}-\frac{1}{6 \pi ^3}\right) y^3+O\left(y^4\right)$$ Now, I made (and may be, this is not allowed) $y=(\pi-x)x$. Replacing, I obtain $$\sin(x)=\frac{(\pi -x) x}{\pi }+\frac{(\pi -x)^2 x^2}{\pi ^3}+\left(\frac{2}{\pi ^5}-\frac{1}{6 \pi ^3}\right) (\pi -x)^3 x^3+\cdots$$ I did not add the $O\left(.\right)$ on purpose since not feeeling very comfortable.
What is really beautiful is that the last expansion matches almost exactly the function $\sin(x)$ for the considered range $(0\leq x\leq\pi)$ and it can be very useful for easy and simple approximate evaluations of definite integrals such as$$I_a(x)=\int_0^x \frac{\sin(t)}{t^a}\,dt$$ under the conditions $(0\leq x\leq \pi)$ and $a<2$.
I could do the same with the simplest Padé approximant and obtain $$\sin(x)\approx \frac{(\pi -x) x}{\pi \left(1-\frac{(\pi -x) x}{\pi ^2}\right)}=\frac{5\pi(\pi -x) x}{5\pi ^2-5(\pi -x) x}$$ which, for sure, is far to be as good as the magnificent approximation given at the beginning of the post but which is not very very bad (except around $x=\frac \pi 2$).
The problem is that I am not sure that I have the right of doing things like that.
I would greatly appreciate if you could tell me what I am doing wrong and/or illegal using such an approach.
Edit
After robjohn's answer and recommendations, I improved the approximation writing as an approximant $$f_n(x)=\sum_{i=1}^n a_i \big(\pi-x)x\big)^i$$ and minimized $$S_n=\int_0^\pi\big(\sin(x)-f_n(x)\big)^2$$ with respect to the $a_i$'s.
What is obtained is $$a_1=\frac{60480 \left(4290-484 \pi ^2+5 \pi ^4\right)}{\pi ^9} \approx 0.31838690$$ $$a_2=-\frac{166320 \left(18720-2104 \pi ^2+21 \pi ^4\right)}{\pi ^{11}}\approx 0.03208100$$ $$a_3=\frac{720720 \left(11880-1332 \pi ^2+13 \pi ^4\right)}{\pi ^{13}}\approx 0.00127113$$ These values are not very far from those given by Taylor ($\approx 0.31830989$), ($\approx 0.03225153$), ($\approx 0.00116027$) but, as shown below, they change very drastically the results.
The errors oscillate above and below the zero line and, for the considered range, are all smaller than $10^{-5}$.
After minimization, $S_3\approx 8.67\times 10^{-11}$ while, for the above Taylor series, it was $\approx 6.36\times 10^{-7}$.
A few approximations
When making approximations, there is no legal or illegal. There are things that work better and things that don't. When making approximations that are supposed to work over a large range of values, often the plain Taylor series is not the best way to go. Instead, a polynomial or rational function that matches the function at a number of points is better. $$ \frac{\pi(\pi-x)x}{\pi^2-\left(4-\pi\right)(\pi-x)x}\tag{1} $$ matches the values and slopes of $\sin(x)$ at $0$, $\frac\pi2$, and $\pi$. However, it is always low.
If instead, we match the values at $0$, $\frac\pi6$,$\frac\pi2$, $\frac{5\pi}6$, and $\pi$ we get Mahabhaskariya's approximation $$ \frac{16(\pi-x)x}{5\pi^2-4(\pi-x)x}\tag{2} $$ which is both high and low, and the maximal error is about $\frac13$ of the one-sided error.
A good quadratic polynomial approximation also matches the values at $0$, $\frac\pi6$,$\frac\pi2$, $\frac{5\pi}6$, and $\pi$ $$ \frac{31}{10\pi^2}(\pi-x)x+\frac{18}{5\pi^4}(\pi-x)^2x^2\tag{3} $$
The maximal error is about $\frac23$ that of Mahabhaskariya's.
If we want to extend to a cubic polynomial, we can try to match values at $0$, $\frac\pi6$, $\frac\pi4$, $\frac\pi2$ $$ \tfrac{9711-6400\sqrt2}{210\pi^2}(\pi-x)x+\tfrac{-7194+5120\sqrt2}{15\pi^4}(\pi-x)^2x^2+\tfrac{43488-30720\sqrt2}{35\pi^6}(\pi-x)^3x^3\tag{4} $$
The maximum error of approximation $(4)$ is about $\frac1{40}$ that of approximation $(3)$.
Analysis of the functions in the question
The function $$ \frac{\pi(\pi-x)x}{\pi^2-(\pi-x)x}\tag{5} $$ has a maximum error about $40\times$ as big as $(3)$
The function $$ \frac{(\pi-x)x}\pi+\frac{(\pi-x)^2x^2}{\pi^3}+\left(\frac2{\pi^5}-\frac1{6\pi^3}\right)(\pi-x)^3x^3\tag{6} $$ has $30\times$ the maximum error of $(4)$. However, the coefficients of $(6)$ are more appealing.