A shower drain needs a trap, so check under the cap on the left to see if there's a trap or a straight drain. If it's straight, then your assumptions are likely right that it's a toilet and the other one is a clean-out (fix that cap, you don't want sewer gases getting it). If you don't have a shower drain here, then I'm guessing it's only roughed in for a half bath.
I don't imagine the 2" would be anything other than a vanity drain.
With the "vent," I'm left wondering if it's really a drain since I see a clean-out installed on it. I'd recommend tracing that line up the walls, as best you can, to verify it really is a vent.
As for where the horizontal line is going to the left, perhaps a washer dryer, or perhaps the plumber screwed up the T and it should be pointing to the right for the sink. It's hard to tell from here.
I don't quite follow your description, the standpipe configuration might be part of the problem. The gurgling toilet indicates a venting problem, I don't think it would contribute to overflowing, but it is a problem. As mentioned, a photo or diagram is needed for better assessment. My intent is to describe a proper washer installation and address how the height plays into it.
There are all sorts of variations for pipe configurations, this one is very typical. The washer drain ties into the 4" horizontal pipe with a vertical 4x4x2 LTTY (long turn tee-wye). It can be installed flat to gain some vertical, at the cost of an extra ell that introduces a potential clog point.
From the LTTY is a vertical 2" pipe as short as possible before connecting to a 2" sanitary tee. A 2" vertical pipe continues up to tie into the venting system. The vent could be reduced to 1.5" if need be. The side inlet of the santee takes a 2" horizontal (2% slope actually) trap arm. There is a length limit, but it's rather long, it's best to keep it rather short. The trap arm connects to a 2" trap assembly. The trap inlet accepts a 2" vertical stand pipe.
The stand pipe must be a minimum 18" high, straight up, no bends. You cannot connect a washer discharge directly to a closed drain system. There must be an overflow provision such as an open stand pipe. I prefer to see about a 24" stand pipe, but 18" is a code requirement.
This gives you about a 24-30 inch tall stand pipe/trap assembly on top of the 48" height of the main drain, so a total 6-6.5 feet off the floor. Washers have a limit of how high they can pump discharge water. The installation instructions should tell you this somewhere. If not, you may need to contact the manufacturer. If your washer can pump up to the top of the stand pipe while sitting on the floor, you're all set. If not, you will need a platform that raises the washer to within the allowable discharge height.
If you still get overflowing with a proper standpipe-trap configuration, then the main line remains obstructed somewhere.
Best Answer
I agree with ArchonOSX, it's very sloppy & does violate code beyond that. It needs to be re-done & even when it's right it should have a metal plate bridging more than its width so nails or screws can't penetrate it for just that bottom stud.
The jog they did has to be a minimum of 1-1/2-inches away from the underside of the floor, again so penetrations can't or aren't likely to happen. It doesn't matter how far back they have to start over with the line or where they have to move it to in order to do it right, it has to be safe from potential damage.