Not a boundary
A boundary shall be scored whenever, while the ball is in play.
(i) the ball touches the boundary, or is grounded beyond the boundary.
(ii) a fielder with some part of his person in contact with the ball,
touches the boundary or has some part of his person grounded beyond
(iii) the ball, having crossed the boundary in the air, is first
touched by a fielder who has not satisfied the conditions below.
Section 4(i) is the requirement that a fielder cannot jump from beyond the boundary to make the first touch on a ball.
The crucial part here is clause (ii) which makes reference only to the current position of the fielder, not any previous position; therefore it doesn't matter what they may have done before the catch is made, it's only where they're positioned while the catch is being made.