Non-turbo subaru motors are not worth rebuilding. A lot of people cant even do it right and they spin bearings 1000k miles into the rebuild.
Pull yourself junkyard motors are like 125, or expect 800 to 1000 for one from a we pull it.
I bought a known good ej251 with revised headgaskets and 90k miles for 800 and dropped it in my turd car. Getting a wrecker motor + having someone do the headgasket and timing on it shouldn't be more than 2500 bucks. Still cheaper than a gamble rebuild.