There's probably an interesting story to be told about actual situations where cities were captured by comparable tricks, but it's also pretty important to keep it clear that
I mention the second point to really ram it home that it's a storytelling device, a mythical motif, and not a historical siege strategy. For fuller details about other occurrences of similar tropes, you could take a look at this answer I wrote a few months back -- but with the caveat that the wooden horse's fictional nature doesn't rule out tricks being used in sieges.