Junction Box size/type requirement
Yes you can use a “device” box as a junction box.
The same rules apply you have to securely mount it.
wires stapled within 8” (my inspectors do not consider the alligator clamps good for 12”)
and it will need a solid cover.
I have done this throughout my career as long as the box is stamped or you use the chart from the code book for fill it is code compliant to use as a simple splice / junction box.