Sure, why not? Why, what sword do you normally use to fight dragons in your day-to-day life?
Seriously though, a rapier was added so that people could live out their 3 Musketeers/Inigo Montoya/Zorro (maybe Puss in Boots? now also Lara Raith?) fantasies. ... Just like every other fantasy trope out there. We also have wizards in the thick of battle without armor because tropes (and balance). Also people wearing plate armor while climbing into unexplained treasure-filled deadly holes in the ground.
Beyond that, it should be mentioned that other swords weren't built for fighting dragons either. Fantasy has always been this bizarre amalgam of 'what if magic and dragons actually existed in old-timey days, but it was still recognizably old-timey days instead of what it would actually have looked like if magic and dragons existed.' That's going to inherently have some dissonance. Frankly speaking, rapiers are not high on the list of the dissonant parts.
Bringing a spear to a fight against a dragon is useless. You're not getting through it's hide before the haft breaks and/or you are swiped into oblivion.
Same thing with the lucerne hammer. "Evade!" doesn't work against a hand the size of a human torso with fingers as long as your arm tipped with claws as long as your hand coming to you at roughly the speed, and impact force, of a midsize SUV.
Fighting a dragon, for real, would be impossible with any melee weapon. And almost all ranged weapons would be equally ineffective.
My point was not about historical accuracy of people encountering T-Rexes, it's that if you want a "dragon" that works according to real world physics you have to strip away a lot of what makes a dragon a dragon. First thing that goes is the breath weapon and flying. Then you ask if the fore-limbs really do anything essential, scale to an appropriate size and suddenly you have a predator that looks a lot like a T-Rex. Convergent evolution created the same basic structure many times over millions and millions of years because it was effective.
Of course you could go the other way and create something like a giant pterosaur like Quetzalcoatlus that had a cobra's venom spit. But you're never going to have anything that looks like a D&D dragon.
Right. If we're going to dismiss weapon effectiveness based on physical realities of mass and strength, we similarly should be accounting for how those same physical realities alter and limit the large monsters.
There's also some tendency for everyone to have invisible implicit assumptions/premises buried in their opinions, and I feel like some of us are talking past each other based on having somewhat different assumptions we're working with. .
Not just the flying, but the sheer scale of dragons as pictured in modern D&D (as Steampunkette, for example, is referencing) is probably an unreasonable thing to assume.
Folks have talked about how "fantasy" describes dragons and fighting them a few times in the thread, but that isn't always monolithic. Many older folkloric depictions of dragons have them as substantially smaller than the dragons we're accustomed to in D&D. Some dragons are also smaller than others even in D&D.
In Gene Wolfe's
The Knight heroic humans battle giants, but the giants are a bit more plausible in scale and shape than we typically see D&D giants, and are much slower in reflexes and turning ability. And humans mostly employ spears and penetrating ranged weapons, only the most heroic or foolhardy getting into melee with them (though able to have some success there using weapons which can get deep penetration and/or using tactics like hamstringing).
Checking the 1977 Monster Manual I see that the chromatic dragons range from 24' in length for a white dragon to 48' for a red. An adult has 5hp/HD, with as low as 5HD for a small adult white dragon and as minimum of 9HD for a small adult red. So we're looking at as low as 25 or 45 HP for those for an adult. Those are still huge, of course, and as SP aptly pointed out, a hippo is enormously, terrifyingly more powerful than a human, at a "mere" 10-16 ft in length. Though dragons are at least somewhat serpentine, with long tails and necks which add to the length, and if we are assuming flight we could also reasonably assume a lighter build is part of that. A dragon 30' or even 50' in total length might be considerably less massive than a 15' hippo.
And in addition to the size, fantasy isn't always monolithic in how mythic or heroically it treats dragons and dragonslaying. In Barbara Hambly's 1985
Dragonsbane, our protagonist hero is a bookish local lord who's earned that eponym by cornering a smallish local dragon in a cave and killing it with a poisoned spear/harpoon. Inflicting a telling wound and getting TFO, as I recall.
This is all to say that while the basic premise of a much smaller animal fighting and killing a much larger animal has multiple basic ways for it to be doubtful and implausible, there are also ways of addressing and adjusting the fiction to make it MORE plausible, if we so choose.