Re: wires in panelboards
312.8 Enclosures for Switches or Overcurrent Devices.
Enclosures for switches or overcurrent devices shall not be used as junction boxes, auxiliary gutters, or raceways for conductors feeding through or tapping off to other switches or overcurrent devices, unless adequate space for this purpose is provided. The conductors shall not fill the wiring space at any cross section to more than 40 percent of the cross-sectional area of the space, and the conductors, splices, and taps shall not fill the wiring space at any cross
section to more than 75 percent of the cross-ectional area of that space.
You are permitted to make splices in the panel enclosure, provided you follow the above code reference.