I have about 10 inches from the motor to the wall. See pucture. Not super clear from this angle but It looks like I can put a coupler in there. Especially if I can get the pipe it out of the valve end. Then I don’t have to re-plumb the input side and deal with pipe so close to the ground. Does this sound right? The coupler would be right at the pump inlet.
If you can get the straight pipe out of the 3-way valve, then go as follows
ensure inside of valve connection is clean and not too rough
glue in another straight piece of pipe (6-8 inches)
glue a union half to the other end of pipe above
screw other half of union into pump -
NOTE - ensure you have the union nut on the pipe before you attach the union half
Join the 2 union halves with the union nut
On output side
place another union as done on the inlet side
add other pipe and ells as needed to connect to filter
EDIT - if you elect not to remove the pipe from the 3-way valve - then cut the pipe as close as feasible to the pump, clean the end and attach coupler to that pipe,
add shorter piece of pipe to that coupler
then add union
The goal is to have 10 inches of straight pipe before the pump (that includes unions and coupler) - you appear to have room for that.