in summary: the load (light) is in the garage, it is fed by a hot that originates in the garage, and it sinks into a neutral in the garage. The odd thing is that a switch loop extends from garage to house -- and in the junction box at the house a neutral is present, but it's not the neutral from that garage light circuit. This neutral in the house j-box is not currently used.
My thanks for Greg Hill's comment, which I've copied verbatim above, and which is an excellent summary of my long question. Read on for additional details, if needed…
I have two "main" electrical panels at my house: one in the house itself, and one in the detached garage. The electrical service comes in at the garage, and then from there to the garage panel, and via a connection to the house to the house panel. (I don't know whether the house panel is acting as a sub-panel from the garage panel, or is served standalone from the main service; I suspect the latter, but can't confirm.)
At the garage are two switchable light circuits, floodlights and down-lights. These are both on three-way switches, with one switch each in the garage, and one switch each in house (i.e. four switches, two for each circuit). The lights themselves are all mounted on the exterior of the garage.
I had previously learned, for the down-light circuit, that the load wire is connected to the switch in the garage, and that the line (hot) wire is connected to the switch in the house.
What I discovered today was that the bundle of neutral wires in the box for the switch in the house (in the same building), all go to the house panel, even though the line (hot) wire in that same box comes from the garage panel (in the other building).
(I found this out, because I had previously tried to install a digital timer switch, locating it at the box in the house, but when I got it hooked up, then as soon as I tried to turn the breaker back on, it would trip. The electrician who did the wiring came to look, and explained the reason, i.e. that the neutral was going back to the wrong panel, so the breaker treated it as a ground-fault, since the current wasn't coming back to the breaker's panel.)
What is the legality of this configuration? Does it meet code? Any particular safety issues to be concerned with?
The issue is mitigated by the fact that, as near as I can tell, these neutrals aren't actually serving anything. The hot returns to the garage and then to the loads via the travelers hooked to the three-way switches. The actual loads are in the garage and are connected to neutrals that go back to the garage panel in the same building.
I found out about the issue when I tried to hook something up to them (the digital timer switch), and that immediately tripped the breaker. So it seems like the neutral wires in the house-side box are unused. Presumably, if there had been anything from the garage-side hot that was using the house-side neutrals, the same thing would've happened (i.e. breaker tripped immediately). So the issue seems fairly self-limiting, and I don't see any reason that would wind up changing.
That said, I have seen some other posts discussing hot/neutral issues. More of them involve multiple neutral wires going back to the same panel, and I didn't see anything exactly like my situation. But based on the discussion I saw in those questions, I have the impression that at least when the neutral is actually used, it's very important that it go back to the same panel (and even the same breaker?) where the hot used with that neutral comes from. And it seems like leaving the wiring like this today, could be laying a trap for someone tomorrow.
I gather that the problems include possible overheating of the wire, as well as overload and accidental contact risks. It seems that these problems only exist with the neutral is actually used, so technically I might not have any hazard now. But does code allow for that situation, even so?