I can't say I agree with your plumber. A good way to find out would be
to get a bucket of hot water and pour it into the drain. If it's the
drain pipe, the hot water from a bucket vs. hot water directly from
the tap is still hot water..and would still cause the same noises. You
can test it yourself. But it's not your drain lines "expanding".
Frankly, cast iron drain lines aren't going to "expand" when you dump
125-degree water into the drains. And just out of curiosity, did he
explain to you why the pipes were only expanding in your bathroom? I
would think that they would expand when you used the kitchen sink or
any other hot water in the apartment. Expanding cast iron..yeah...
stupid explanation = "I don't know" = call another plumber
You haven't described the sound. You might need a hammer arrester.