Mathematicians prefer to define modular arithmetic in terms of congruence, rather than as an operation on natural numbers. We say that two integers $a$ and $b$ are "congruent" modulo $n$, and write $$a \equiv b \mod n$$ or $$a \cong b \mod n$$ when $n$ divides evenly into the difference $a-b$. To see how this connects to the operation way of understanding things that you're more familiar with, "$a \mod n$" is the smallest non-negative integer congruent to $a$ modulo $n$. For example, where you might be more familiar with the statement "$53 \mod 29 = 14$", we prefer to write $53 \equiv 14 \mod 29$, and $14$ doesn't really have any special significance here; it would be equally correct to write $53 \equiv 82 \mod 29$, or even $53 \equiv -15 \mod 29$.
Then the key fact at play for your question is the following theorem: if $a \equiv c \mod n$ and $b \equiv d \mod n$, then $a+b \equiv c+d\mod n$, $a-b \equiv c-d\mod n$, and $ab\equiv cd \mod n$.
This theorem says that to compute the sum, difference, or product of two numbers modulo $n$, one may substitute any other congruent number in place before computing the arithmetic operation. In particular, to compute $(X+Y)-Y$ modulo $29$, one may reduce $X+Y$ modulo $29$ before computing the difference, which is what you've observed. Mind you, $(X+Y)-Y = X$, so one could also compute this just by reducing $X$ modulo $29$ and calling it a day.
All of this is detailed in the wikipedia page on modular arithmetic.