Yes. Get the right toilet.
You can get a small number of WC pans that connect to a floor socket without needing an elbow adaptor. If the floor is concrete it is impractical to move the soil pipe.
Can you measure the distance from the wall to the centre of the socket, and also from the wall to the front of the pan, since you say space is limited.