3 way switch bathroom wiring to code
Current Code has very particular requirements for bathroom receptacles i.e. dedicated and 20A.  This does not apply to bathroom hardwired loads.  So we can avoid diving into that complexity.
The word &quot;outlet&quot; is ambiguous because NEC refers to everything as an outlet lol.
A hardwired load can be 15A or 20A if that's suitable for the loads. It can be on any circuit (except for certain circuits which are required to be dedicated to a different task, such as kitchen receptacles, garage receptacles, laundry room receptacles, bathroom receptacles, furnace, water heater, etc.)
This is also true of bathroom hardwired loads. They can be on any circuit not dedicated to something else. (and the above complexity that we're ignoring relates to putting them on bathroom recep circuits, which is useless here).
I imagine that for simplicity, you want to have the bathroom light/fan and the closet light on the same circuit. That is fine, as long as it is NOT a bathroom receptacle circuit.
It doesn't matter if the switches are in the bathroom.