This is fine as long as they can be joined end-to-end, are identified for through-wiring, or are listed and marked as a raceway, as per NEC 410.64. Just keep in mind that end-to-end joinable luminaires are limited to one branch circuit (that must feed one or more luminaire(s) in the set) in addition to the circuit that is feeding the remaining luminaire(s).
410.64 Luminaires as Raceways. Luminaires shall not be used as a raceway
for circuit conductors unless they comply with 410.64(A), (B), or (C).
(A) Listed. Luminaires listed and marked for use as a raceway shall be
permitted to be used as a raceway.
(B) Through-Wiring. Luminaires identified for through-wiring, as permitted
by 410.21, shall be permitted to be used as a raceway.
(C) Luminaires Connected Together. Luminaires designed for end-to-end
connection to form a continuous assembly, or luminaires connected together by
recognized wiring methods, shall be permitted to contain the conductors of a
2-wire branch circuit, or one multiwire branch circuit, supplying the
connected luminaires and shall not be required to be listed as a raceway. One
additional 2-wire branch circuit separately supplying one or more of the
connected luminaires shall also be permitted.
Also, in your case, as per 410.21, the luminaire must be identified for through-wiring in its integral junction box:
Branch-circuit wiring, other than 2-wire or multiwire branch circuits
supplying power to luminaires connected together, shall not be passed through
an outlet box that is an integral part of a luminaire unless the luminaire is
identified for through-wiring.