I'd use a flush mount NEMA 1 pull box and mechanical setscrew/splice connectors
While an ordinary junction box is simply too small for splicing 4AWG conductors, larger boxes are available. These are called pull boxes or NEMA enclosures, and in particular, you need a flush mount (into the ceiling), NEMA 1 (indoor) box. Size-wise, you are looking at a minimum dimension of 6" across as a 4/4/4/6 or 4/4/4/4 SER cable will fit into a 1" conduit of the appropriate type (nobody uses Type A PVC conduit, but it provides the most fill area/diameter of any conduit type in the Code, so its what's used when transposing cable sizes into conduit sizes for this) and NEC 314.28(A)(2) requires the box to be at least six times as long as the largest conduit entry into it, more or less:
(2) Angle or U Pulls, or Splices. Where splices or where angle
or U pulls are made, the distance between each raceway entry
inside the box or conduit body and the opposite wall of the
box or conduit body shall not be less than six times the metric
designator (trade size) of the largest raceway in a row. This
distance shall be increased for additional entries by the amount
of the sum of the diameters of all other raceway entries in the
same row on the same wall of the box. Each row shall be calculated individually, and the single row that provides the maximum distance shall be used.
Exception: Where a raceway or cable entry is in the wall of a box or
conduit body opposite a removable cover, the distance from that wall to
the cover shall be permitted to comply with the distance required for one
wire per terminal in Table 312.6(A).
The distance between raceway entries enclosing the same
conductor shall not be less than six times the metric designator
(trade size) of the larger raceway.
When transposing cable size into raceway size in
314.28(A)(1) and (A)(2), the minimum metric designator
(trade size) raceway required for the number and size of
conductors in the cable shall be used.
Inside this box, the actual wire splicing is performed using appropriately sized mechanical splice connectors ("Polaris" or "Unitap" are common trade names for them) for the hots and neutral, and a small equipment grounding bar for the ground wires -- this ground bar screws into a pre-tapped hole for such on the back of the box using a 10-32 machine screw. All of these connections will need to be torqued to manufacturer specification using an inch-pound torque wrench or torque screwdriver, by the way.
As to mounting the box, you'll want to use a piece or two of scrap 1x or electrical strut ("unistrut") as crossmembers between the joists to mount the box to, given that your average NEMA 1 box is designed to be mounted through the back, not a side. You'll need to screw it to the crossmembers with the appropriate screw for the crossmembers you're using, too -- NEMA boxes are not designed to be nailed to things.
The RV outlet is a subpanel
The good news is that the RV outlet assembly is a subpanel, so provided you use appropriately sized cable (6/3 copper NM is fine here provided physical damage is of no concern), it's no different than any other situation where you have two subpanels on the same feeder. The "feeder tap" rules in NEC 240.24 do not apply here, by the way, since the conductors from the splice point to the RV outlet assembly are sized for the full 50A the breaker in the main panel will allow.
(As a sidenote, this logic does not apply to a simple receptacle -- the use of a plain receptacle here would result in a mix of utilization devices and subpanels on the same circuit section, which is something that the NEC does not appear to contemplate.)