Technically it is just fans' assumptions that clans have to keep it within the family. We technically have no proof of this. Think about this:
Mikoto could have simply gotten the name of Uchiha from marriage. It's not like we ever saw her use sharingan or fire style. This is not to say that it is guaranteed that she wasn't Uchiha by birth, but you never know. As to why Sasuke and Itachi got sharingan : Doujutsus are probably dominant traits.
This theory is further supported if you think about Indra. Indra was the first Uchiha. Who could he have possibly married that had the genetics of an Uchiha? Nobody! Yet the sharingan still passed down for many generations. Therefore they probably don't have to worry about Uchiha genetics being lost due to diluting blood.