From the Player's Basic Rules, page 71 (or PHB p. 191):
In contrast, you can move through a hostile creature's space only if the creature is two sizes larger or two sizes smaller than you.
An ogre is a large creature and elves are medium. So an ogre can't move through an elf's space. In your previous example, if we have a 10-foot wide passageway with two elves standing side by side, the ogre can't get through without killing one of the elves or forcing them to move.
The rules on squeezing into a smaller space are for an ogre trying to move along a 5 foot corridor. The rules on creature size that you've quoted back this up—the ogre isn't actually 10 feet wide, that's just the space he controls. So he can move through a 5 foot wide gap, but it's cramped and he can't move freely.
Now, you might be thinking that it's a bit unfair on the ogre if the 2 elves can form an impenetrable barrier against it. As you've said, he'd rather shove them aside than squeeze between them. And he can do just that! From the Player's Basic Rules, page 74:
Using the Attack action, you can make a special melee attack to shove a creature, either to knock it prone or push it away from you. If you're able to make multiple attacks with the Attack action, this attack replaces one of them.
The target of your shove must be no more than one size larger than you, and it must be within your reach. You must make a Strength(Athletics) check contested by the target's Strength(Athletics) or Dexterity(Acrobatics) check (the target chooses the ability to use). If you win the contest, you either knock the target prone or push it 5 feet away from you.
So you're right, shoving is the ogre's answer here.
Now, with your new example, (2 elves in a 15 foot corridor with a 5 foot gape between them), things are different. The ogre does indeed have to squeeze between them. Fortunately for him, it's not going to matter all that much.
Why? Because he's almost guaranteed to be moving on his own turn. Unless there are more enemies than just the elves, he's not going to provoke any opportunity attacks while squeezing, and he can attack before or after he squeezes. So the only squeezing penalty that is actually going to apply to him in this situation is the double cost for movement.
Note that if he stopped between the elves, all these penalties would apply to him. That makes sense though—standing between two enemies with not enough space to move around in would make it difficult to dodge attacks or attack effectively.
Space doesn't only mean the area you physically inhabit in combat
An ogre isn't 10 feet tall by 10 feet wide, they simply command a 10 X 10 combat square area. It would have a penalty to Dex moving through a 5 foot wide square because it can't effectively dodge when the walls are brushing up on it's sides.
This is the same for Medium and Small creatures, who command a 5 X 5 square. They don't command that area because they're that big, they command it because they're actively engaged in combat inside of it and moving within it.
Basically, you've equated combat squares with obstacles to movement in general.
For example: A space large enough for a medium creature to move freely through would be a standard door. However an ogre would need to squeeze through because they're wider and taller than a standard door.
So when you're looking at a medium creature squeezing through a small creatures opening, it's akin to an average person trying to move through a crawl space. While the small creature would be able to do it easily, the medium creature would need to squeeze.
For example, I ran a game with a bunch of small creatures pestering the party and retreating to bolt holes with an opening that would only accommodate small creatures. That means the opening isn't 5 feet wide. By squeezing rules, a party member of medium size could have traversed the tunnels, albeit slowly and at significant disadvantage. Whereas the enemies could freely move and attack using the tunnels for cover and being an extreme and persistent annoyance.
Best Answer
The Mount size determines space control
Page 191 of the PHB specifies:
This gives us a baseline for how much space a particular creature takes.
Mounted rules from PHB page 198 also state:
This shows that there is usually a progression in space control as you move up in sizes. The only outlier is Small->Medium where both sizes control the same space.
Finally, it is suggested that Opportunity Attacks when mounted are generated from the area controlled by the Mount (PHB, 198):
This strongly points toward the idea that the creature's space is the total space.
A medium creature mounted on a large controls a 10'x10' space and can squeeze through a 5' wide opening.
The squeezing rules from PHB, pp192) state:
Using this, we know that Medium creatures (who control a 5'x5' space) must mount Large creatures (that control a 10'x10' space).
While there isn't a specific rule about combining creature sizes, the OA recommendation suggests that the space controlled by the mounted and rider is determined by the space controlled by the size of the mount (which is the larger creature.) Otherwise, the OA would be additive and include both the spaces controlled.
The Large mount and Medium rider therefore can squeeze through a 5' wide space.
However, this ruling is not particularly strong depending on your analysis of Mounted Opportunity Attacks and Reach. But when imagining how a mount and rider work together, then it makes more sense.
Theatre of the Mind
Another way of looking at this is through your imagination. Consider a humanoid riding a horse and trying to go through a smaller space. The humanoid would against the back/neck of the horse and streamline as much as possible. The humanoid really doesn't contribute much to the overall space when doing that.