Hahah, I'm actually thinking of doing this to my truck. However, it won't be sandwiched between the tranny and driveshaft.
The transmission tailhousing can be swapped out with a PTO for 4x4 mode. So I plan on changing that out and then attach the electric motor to the yoke of the PTO portion and drive it that way. The gearing in the tailhousing doesn't have spider gears, it's heavy duty chain driven so I don't have to worry about over driving the gears.