There is an exception for certain size and number of electrical boxes that can penetrate the membrane of a fire resistance-rated wall Design that can be found in the BXUV GuideInfo:

Metallic Electrical Outlet Boxes

Certified single- and double-gang metallic outlet and switch boxes with metallic or nonmetallic cover plates may be used in bearing and nonbearing wood stud and steel stud walls with ratings not exceeding 2 h. The metallic outlet or switch boxes should be securely fastened to the studs and the opening in the gypsum board facing should be cut so that the clearance between the box and the wallboard does not exceed 1/8 in. The surface area of individual metallic outlet or switch boxes should not exceed 16 sq in. The aggregate surface area of the boxes should not exceed 100 sq in. per 100 sq ft of wall surface. The aggregate surface area of the boxes may be exceeded when Wall-opening Protective Materials (CLIV) are installed according to the requirements of their certification.

Metallic boxes located on opposite sides of walls or partitions should be separated by a minimum horizontal distance of 24 in. This minimum separation distance between metallic boxes may be reduced when Wall-opening Protective Materials (CLIV) are installed according to the requirements of their certification.

Metallic boxes should not be installed on opposite side of walls or partitions of staggered stud construction unless wall-opening protective materials are installed with the metallic boxes in accordance with certification requirements for the protective materials.

Where the size, number or concentration of electrical boxes is outside the specifications described above, a certified Wall-opening Protective Material can be specified to meet applicable code requirements. These materials can be found by searching UL product categories CLIV and QCSN