Swords are actually extremely expensive for the average medieval guy.
The average medival guy is a peasant and can't afford any kind of actual weapon, so is probably using some kind of farming implement improvised into a weapon. That...doesn't really cover the typical Adventureman.
Also, you are overexagerating the portability of a sword. You can have a short axe with 40cm length and it will not be awful vs armor like a sword.
True, but on the other hand, your average opponent does not have much in the way of armor, and the sword has better reach when thrusting. If you're getting into fights with armored opponents, you are probably on a battlefield.
Same in modern times, you can have a bullpup short barrel rifle inside a overcoat.
Ah, yes, the Trenchcoat of Inconspicuousness. If you try this, the police may give you trouble. On the other hand, if you are carrying your pistol inside your suit jacket, at least here in the US, this is legal in many places.
The idea of someone using a sword against a dragon in a fantasy setting is awful like someone using a 9mm pistol to fight a Panzer V IRL instead of a weapon like PTRD 1941.
The idea of someone using ANY kind of hand weapon against a dragon is pretty absurd, period. If you're going get into fights with dragons, you probably want to bring along a ballista. And you're still going to be carrying your sword, just because it's the generic sidearm.
When people go search a Bear to hunt, they generally use spears, warbows, traps, etc on medieval times and hunting rifles in modern times.
Yes, which makes sense, since these people are specifically looking for a specific form of trouble, and therefore, are carrying specific tools for the job: Not even ordinary spears, but specific boar spears that have a crossbar on it to stop impaled boars from getting to you.
A spear can be used in narrow parts. Just thrust forward. A halberd, just grab the weapon closer to the blade. You don't need to do 360º swings;
Yes, spears are very practical weapons and don't get nearly enough love, but you know what a spearman often also carries? A sword, for stabbing people in situations where the spear has been counteracted in some way. Because swords are extremely convenient sidearms like that. The spear is basically the equivalent of your medieval battle rifle, and an adventureman expecting to get into fights will probably bring one along. It is not, however, a subtle or inconspicuous thing to carry, and is unsuited for the 1v1 fights an adventureman often finds himself in. A 1v1 with two guys with spears and shields is basically a stalemate broken only when somebody pulls out their sword. But I agree, it's very much underrepresented in games, spears should pretty much be the primary weapon. But you're definitely still gonna have a sword, as your sidearm.