About words with a medial /d/ and a flapped /t/

Solution 1:

No, they're not. The vowel is longer before a /d/ than before a /t/, and this serves to help distinguish them. This is because in English, vowels lengthen before voiced consonants.

If the vowel is /aɪ/, in many American dialects the vowel not only lengthens but its quality also changes (this is called Canadian raising) and the words are quite distinguishable.

In the case of really short vowels, like bitter and bidder and putting and pudding, the length of the vowel doesn't help all that much to distinguish the words, but they're still generally not considered homophones.