I think it applies to a lot of areas of mathematics, but not everything necessarily has an intuitive approach from first principles that someone might be expected to notice. Sometimes people stumble upon things by experimentation, or by being very clever and noticing patterns/relations, and so on. Once you "know the trick" it becomes a new tool you can use even if it doesn't have an obvious motivation.
This particular integral even gets mentioned as a specific example of accidental discoveries in Spivak's calculus:
There is another expression for the integral of sec x dx, which is
less cumbersome than $\log(\sec x + \tan x)$; using Problem 15-9, we obtain
the integral as $\log(\tan(x/2 + \pi/4))$. This last expression was
actually the one first discovered, and was due, not to any
mathematician’s cleverness, but to a curious historical accident: In
1599 Wright computed nautical tables that amounted to definite
integrals of $\sec$. When the first tables for the logarithms of tangents
were produced, the correspondence between the two tables was
immediately noticed (but remained unexplained until the invention of
calculus).
So in this case, even the first discovered answer is still useful information as it now gives you an endpoint for other transformations and substitution experiments in terms of direction. But sometimes discoveries are just accidents and any "intuitive" explanation is going to come after the fact with that pre-knowledge driving it.