7594: power rules correction so (x**y)**z != x**(y*z)

fixes #7594
Before it would substitute such that the integrand became `4*sqrt(tan(theta)**2)*cos(theta)`, which worked because it assumed `sqrt(tan(theta)**2) == tan(theta)`. For this to work again we could force the simplification and then add appropriate restrictions on the domain of the result.