T-Mobile can't work "legitimately" with Apple to unlock another carrier's subsidized phone. You're saying that Apple unlocks competing carriers' iPhones? Show me the documentation. AT&T could ask Apple (that's all they need to do) to unlock their phones which have completed their payback of subsidy. The unlock goes through iTunes and all that's necessary is for Apple to enable the unlock. They wouldn't unlock handsets that were subsidized by another company.
As others have pointed out - all unlocks are handled through Apple. In Europe - if you have a phone from a competing carrier you can still have another carrier unlock it (provided you pay a fee / on a contract with them etc - depends on the carrier).
The unlock request is still handled though Apple though as Apple just provides carriers with a interface to add IMEI's to the whitelist (or removing them from the locked list - however Apple handles this). For instance - when I bought my iPhone from the Apple Store, it was actually a factory locked AT&T model but they "turned it into" a factory unlock when I paid the full price for it.
The same thing could happen with T-Mobile - Apple could provide them the same interface to unlock phones that they give European carriers. AT&T would fight - but they would have little course for action if the phone was taken off contract in a legal way (IE end of contract or the ETF was paid).