How to handle a break in a circuit due to removal of a fixture?
Sounds like you understand the constraint of having the splice in a box. Like a lot of people on here, I am weary about in-wall splice products like the one mentioned in JACK's answer, although I admit I don't have much experience using them.
I would look very closely at the possibility of running a new cable. Sometimes it can be easier than you think and might not involve too much drywall damage/repair. Assuming the cable terminates at the receptacle on the left, I would start there. Remove the receptacle and disconnect all the wiring. Use a hacksaw blade to cut the nails that hold the junction box to the stud and remove the box.  Reach into the hole and try to remove the staples that fasten the cable to the stud near the box.  Then  fasten a string or fish line to the cable and pull the cable through the studs back towards the wall area you have open.  With a little luck the cable will pull through and you can use the string to pull a length of new cable.  When you are all done, don't forget to replace the box you just removed with a new &quot;old work&quot; style box that clamps the drywall edge to hold it in place.
We can't see where the other end of the cable goes, but if it goes to another box close by you might be able to repeat the process on the other end, or maybe by just replacing one side of the cable, you would have enough freedom to move the box to a more desirable location, like higher up on the wall where the box could be hidden behind a clock or wall art.  Although it doesn't look like it would apply in this case, if you could move the splice towards the floor you could put a box with an outlet there and not have a &quot;weird&quot; box in the center of the wall with a blank plate on it.
Don't forget to consider the what is on the other side of the wall.  Depending on how you use the space, the other side of the wall could be a better place to have the junction box, and it would not be too much work to cut a hole in the drywall and mount the box the other way.