Your best bet would be to find a crashed 5th gen GT and swapping over everything including the pedal box, clutch master/slave and wiring harnesses. Would be completely straight forward and you'd be best off getting the brakes from it as well.
You may have more luck finding a H6 donor and you take the driveline from that (Although still stuck with an automatic)
Physically, the EJ255 from the 5th gen LGT and an 08+ STI are very similar. Both have dual avcs and the same shortblock with the only real difference being that the STI EJ257 gets a better exhaust cam (Which you can swap over)
Aside from that, the LGT has a 2 piece oil pan with an oil scavenge pump for the low mount turbo, plumbing and a difference in how the engine mounts. The Legacy doesn't have a traditional engine cradle and engine mounts the Impreza chassis do.