Can you change the color of caulk when staining grout in a bathroom?
Your concern that the grout and caulk might take the stain differently is well-founded. Since the materials are so cheap relative to the effort of re-caulking (or, heaven forbid, re-grouting), you should pick up new grout, caulk and stain, and do a test on a piece of plywood. Make sure the grout and caulk have completely dried, or the results won't be comparable to doing it in your actual bathroom.

If this test works, and you get the same color on the grout and caulk, then you're still left with the uncertainty of how to apply the stain without it discoloring the adjacent tile and fixtures. So, think carefully about how you'd apply it, and do another small test in an inconspicuous part of your bathroom.