I ask myself this question a lot. For junipers, you can do either but since their strength is in the foliage repotting first makes sense. I would still clean it up and remove dead branches, crotch growth, ect. For pines, the strength is in the roots so as long as the soil isn’t atrocious I’d tend to do the major cutbacks on pines first. My default usually is to prune and style the tree first because then I’ll know what angle to repot it at and I know that the tree will be able to move water.
You should also consider the height of the tree. You don’t want to repot a 4’+ nursery stock tree into a small container because it could blow over or put a lot of physical stress in the rootball. Also keep in mind that most nursery stock is going to be very vigorous, probably the most vigorous it will ever be, so they can handle some major work that yamadori probably could not. That is not an excuse for poor timing it technique however.