I know that I won't adequately answer this question and that my position and POV will repeat some of what others have said and contradict some as well. I also know that my answer is more and less valuable than just a pedagogical defense because it is steeped in personal experience. But it, as an (non)answer, has been brewing inside me for many years and this is the forum which will be unlucky enough to host my rantings. You might want to skip to the next post now.
I started high school with 3 years of very rudimentary mishna under my belt. Either I was a poor student in grades 6-8 and have forgotten, or the curriculum said very little about an amora vs. a tanna or much else by way of contextualizing the mishna. I learned to compute a sha'ah and memorize whose opinion stated what regarding when to say shma in the morning and evening. I don't recall much else. So in high school, I was placed in a class with students with limited backgrounds. We worked on vocabulary and the basics of gemara. Most students hated it -- I mean, it was a 3+ hour shiur, daily, and if you aren't interested in being in school, or with this rebbe, that's gotta stink. I loved it. If I could have stayed with the rebbe and skipped math, science and history, I would have done it and my GPA would have thanked me. But in school, you take what is required and I plodded through Chem and Trig.
By the next year, I moved up a track. Again, many kids resented most everything about shiur, from the rebbe to the room. I blossomed. I was still at a relatively "low" level, but I was thirsting for more. The next year, when I was moved up into a much higher shiur, I again thrived (throve?). The subtle arguments, the wending logic, the layers of interpretation, and the knowledge that there was always room for even more innovation -- that I could stumble upon a question that no one had asked and it would be as valid as something studied over the last 2000 years. The combination of frontal learning, chevrusa time and a variety of testing modalities really worked for me. I wasn't bored (usually) and the classroom approach welcomed challenge and the rebbe was willing to explore tangents and derive meaning from text whcih impacted on my practice and beliefs. Meanwhile, physics and geometry crushed my spirit.
By the time I went to college, I was overprepared. I took an intermediate Talmud class expecting an easy A and got a C (as did the other yeshiva student in the class). I was told, in class that I "think too much" and that I "ask too many questions." And in fact, it took until my senior year that I found a college class which made me think on anything approaching a level of 9th grade gemara (it was a philosophy class which demanded that the students find a nafka mina between two statements of Aristotle).
Gemara taught me to think. It taught me intellectual honesty mixed with freedom. It taught me that the devil is in the details but the big picture matters. It taxed my memory and it drove my creative side. It helped me appreciate the relevance of the esoteric and the transcendence of the mundane. I learned about structure, development, device, character and all sorts of tools that I used when teaching Shakespeare, years later. It taught me not to wait for the bell or measure progress by page numbers.
But I am not every student, and I know that someone could wax poetic about how math class changed his life, while I sit here and still feel the pain of consistently impossible math topics and horrible teachers. We DO think that the subjects we teach are valid and necessary, and we defend teaching them because we think that they contribute on the level of both specific knowledge and general intellectual development. A future English major does have to take pre-calc and physics, while a future engineer does have to read novels. Unless we rethink our entire approach to schooling (which I am currently doing and I have some revolutionary ideas...) , we have to see that a subject like Talmud has some underlying value, even without the formal background of solid chumash or mishna. It is all in how it is taught and the connection the teacher makes to the student, a truth resident in all subject teaching. Maybe it has to do with heritage, maybe with legal development, or logical thought or maybe with something else. But it is there and the experience can be made into a positive or negative one.
For some reason, I loved sitting with a rebbe for 3 hours and delving into the gemara and my friends preferred trig. There is no singular explanation for the variety of reactions students have to classes, but when a teacher in either subject goes into the classroom, he has to see that there is the potential for many outcomes and has to work to draw in those who are not naturally connected.
So why do we teach it? Because it is somehow who we are. Because it adds to the mind's growth. Because it is there. I don't know. I'm just glad we do.