Lol. That sucks!
Whoever did that..... Should be shot!
I'm sorry to hear about your septic issue.
You may want to put this on hold and have someone come out to do this, If you dug this out for them the labor would be reduced immensely. But if you have the time and your up for some digging, a small challenge, and going to the store several times then have at it.
Basically, there isn't enough pipe after that tee to put a new fitting on,if you do the fitting will blow off. As well it appears that just to the left of the tee there isn't enough room to put a fitting on there either. ( I could be wrong though, there might be Just enough to put one on. But you still have to rebuild half whats there. It would actually be easier to rebuild the entire thing.
I recommend to dig 3x bigger then what is in the picture, exposed all the pipes and cut them out. Then rebuild the valve manifold and make all the pipes straight and neat, then connect back into the existing lateral pipes.
I see dry wire nuts and horrible splices, re do all of those too.
Whats what that 90 elbow just cut like that, was there a tee that led into that pipe that you cut out?
Yeah, it's pretty much one big suckfest! Shoot me - I did it.
I think the 90 elbow was left by the last guy who fixed the other in-line valve. It doesn't seem to go anywhere.
There seems to be just enough room on each end to connect pipe. Could I use elbows - attaching one to each cut off pipe and just raise the valve?