It is a mitzvah to have sex when you're marriage. Just like it's a mitzvah to bury the dead, replenish the earth, sacrifice to Hashem when there's a standing temple. But those mitzvot do make a person tamei by their nature, coming into contact with death.
Doing a mitzvah can make a person tamei, which is why "unclean" is such a shoddy translation of the word tamei. Jews understand -- or, at least, SHOULD have been taught well to understand -- the difference between being in a state of tamei versus being in a state of sinfulness. We're taught specifically to feel our own sexuality, to acknowledge it, to enjoy it with our spouses, and then to purify ourselves so that we can enjoy it again as soon as it is permitted to us.