Should I use underlay when tiling a bathroom?
If you have wood underlayment that has been water logged, you really should get rid of it. i would remove all layers of old flooring and underlayments down to the primary flooring. If the primary flooring is still wet, dry it and seal it with a primer.  If there are any signs of rot, replace it.  

Let's assume the primary floor is salvageable. Tile should have a full 1.5 inches of solid base so flexing is not an issue. Any flex or bounce in the floor will cause grout to crack and tiles to come loose.

Tile is best laid over a cement based underlayment. Concrete board or "Hardy Backer" is a good choice. This underlayment should be screwed down and screw indents filled with leveler or embossing compound.  Plywood sub-floors have been used for years and tile installed on them, but with that said, masonry underlayment is still so much better, just as easy to install and not much more expensive.

The main issue here is not to install tile over a wet or damaged sub-floor. It would be a waste of time and money when your tile lifts or the grout cracks. Mold is always a possibility where moisture is trapped.