When I had the 999 built for my Scrambler, I used the internal parts and output shaft and tail housing from my Jeep 998, and the Case and front section from a small block 904 series trans. The resulting transmission was much shorter than a 4wd truck based 727. I then mounted my trans and transfer case in the stock location, with several inches of clearance between my fan and the radiator, which needed a longer, semi custom shroud to span the gap.

Your setup with a YJ will be similar, as the 904 based trans is the automatic used in them. You will need a radiator with different inlet and outlet; one for a SBC conversion works well.