I remember a similar problem in Calc 2. I forget the specifics now, but I think it was an integral of some combination of sin/cos that ended up being circular. You had to recognize an opportunity to swap one of the steps for an equivalent, which would lead you to the final solution.
Probably the second example here [1] for those curious (I think the integral of sin(x)*e^x dx is the only place I've seen this used, would love to know if there are other examples).
It would be great if that were how it was taught, but when I took the class it was taught as a trick. No theory behind it, just the prof on the board saying, "But look! :swap: And now you can integrate it."
It becomes a technique once you realise it is a specific case of change of bases.
Even just getting to basic theorem of algebra does not provide this insight.