The mentioned problem is related to the "old" NIP-04 specs, with which DMs leak metadata. The new NIP-17 version is safe. Tor has no role in this.