I just got done pulling the drives off a 331 Bobcat and a 312 CAT and most of them are made basically the same way, regardless of the machine size. That said, if the motor is leaking into the planetary housing then you might as well plan to have the whole thing rebuilt, or replaced. I say this because most leaks like that occur because the motor's output shaft is grooved allowing the seal to leak. If that is the case then it should be leaking hydraulic oil pretty steadily, causing it to build oil pressure in the planetary housing and blow past the seal. If that's happening, the oil level in the hydraulic tank should be going down. If your not losing hydraulic oil then the most probable cause is the planetary housing seal is just leaking. If that happens then you'll lose the oil that lubricates the planetary gears and the bearings, and that's not a good thing either. There are different types of seals used to seal the planetary housing but a leak is a leak regardless.
Either way you need to get the whole thing out to work on it. To repair whatever the problem is you'll need to start by pulling the track. Once the track is off unhook your lines and cap them. Being on the lowest point in the system they will usually leak oil to some degree as long as they aren't hooked up. Next look around the outside of the motor housing for a ring of bolts that holds the whole assembly to the track frame and take them out. If it's like the ones I just took out on the Bobcat and the CAT you might have to use a block of wood and actually drive the assembly out since they are usually a relatively tight fit in the housing.
Once out, I'd start the teardown by disassembling the planetary as getting into the motor is a bit more than most of us would want to deal with. Took the CAT I pulled straight to a repair shop since I knew the motor was bad. On the Bobcat the planetary was the problem and I started dissasembly there. Once I got into it and saw what all was wrong I made a few calls.
I knew I would have to go into the motor so I called the guys that did the 312 motor drive for me. He said often the smaller drives weren't really worth repairing once you got into them, expecially if you had motor problems and not just planetary problems. In my case, just to repair the planetary side of things was going to be nearly as much as I could buy a completely new assembly from from Bobcat. In this case it was around $3500, brand new, not reman (so no core involved). I even looked into an aftermarket drive. The guy there told me that if he could find me one to replace it it would be in the $3000 plus range. On the other hand he said most of the CAT, Hitachi, Komatsu, etc drives were in the $6000 range from the OEM but the aftermarket's on them were in the $3000 plus range, so $3500 for an OEM assembly wasn't a bad deal.
In the end it's worth tearing into to see what's wrong. However if the problem is much beyond just changing a seal then you might as well look into just replacing the whole thing as an assembly as it might be cheaper.