Rip VW Bravo on that explanation! you have demonstrated a fantastic willingness to help out and that is what we are all here for! My hat is off to you! Now I am gonna give some advice that sounds so off the wall you might never follow it
however I know it to work. The idle air controller accumulates carbon as milage occurs and my only explanation is that the computer compensates for the build-up and then the battery dies or you disconnect power to change engines anyhow the loss of power wipes out the memory and now the computer is no longer compensating for the carbon accumulated and its hard to get a good idle. I pull off the hose to the throttle body (from the air cleaner) and clean out the throttle body with a carburetor cleaner be sure to get in proximity of the Idle air controller it has a hole that goes to the spool valve it controls.I usually use most of the can of carb cleaner and you will have to work the throttle to keep the engine going but once you are done it's back to a workable idle. best of luck and keep us posted !!!