How do I attach a receptacle box to brick instead of a stud?
There is no obligation to attach an outlet box to a stud.  There are many applications where a box is "free floating" in a plaster wall using boxes that have various types of flanges that lock the box in.  Boxes are sometimes embedded in wooden boards, such as baseboards.

The important thing is to ensure that the box is firmly secured.  This could be done by screwing the box into the brick (using masonry anchors) through an existing opening in the box.  It may be more practical to obtain "old-work" type boxes that have their own retaining mechanisms. the box is slipped in, then the retaining mechanism is tightened to grip the back of the plaster and lathe.