The thing I find most interesting thing about this question is the way the answer would shift if the question were made plural.
As Rathony says in a separate answer, if the speaker who begins by saying "This is an excellent photograph" remains focused on that particular photograph (which, obviously, was taken in the past), it makes sense to ask about it in the form "Did you take it yourself?"
But suppose that the speaker wants to know not merely about this particular photograph but more generally about the other person's interest in photography as an ongoing activity. To express that idea in a brief question, the person legitimately might ask, "Do you take them yourself?" Most native English speakers would consider
This is an excellent photograph. Do you take it yourself?
to be incorrect, but would consider
This is an excellent photograph. Do you take them yourself?
—where "them" alludes to the unspoken idea of "photographs like this one"—to be perfectly acceptable. Perhaps an imperfect awareness of this shift in tense caused your teacher to make the wrong choice in connection with "Do you take it yourself?"/"Did you take it yourself?"