Monopolies aren't inherently illegal. See e.g., patents and copyrights, which are legally granted or protected monopolies.
What is illegal is anti-competitive practices. This doesn't require a dominant or even majority market position--authorities in the US and EU have gone after companies with relatively small market shares that engaged in anti competitive actions (though they haven't done so in many years).