So just curious, does it throw these codes immediately, or while you are driving it? Were they there with the old engine? Also I assume you checked basic stuff like ATF fluid level, and that nothing was left disconnected during the motor swap. When I am hunting down codes, I like to use a process of elimination to arrive at the bad part. I often find codes that pop up in sort of a chain reaction, and often times was something simple like a loose connector, or I added in too much ATF - as examples. Seems like anything will put the trans in "limp mode" (no 4th gear). When you clear the codes does 4th gear work till the MIL appears? - There are ways to 'tweak' the code within the ECU/TCU, but that info is very hard to come by unless you speak Russian and are really handy with assembly code. There are "updated" software revisions that can be reflashed to the ECU/TCU via GM's Tech 2 hardware, or a tis2web subscription. I would suggest to go here:
https://tis2web.service.gm.com/tis2web and enter in the VIN of your Aveo and see if there are any updates for your modules, some updates address false DTC's being thrown. Not sure if this is your issue, but it may be of some help in chasing down intermittent codes. From what I have read some Aveo's went out with some buggy firmware in the MR140 units. FYI