Rock types and Fighting types are generally tough and strong literally.
Rock type gyms are usually first gyms as it has type advantages or disadvantages to the starters' type. Even Ground types have, but Rock types are at the disadvantageous side, having 5 weaknesses rather than the Ground types which have only 3 weaknesses, thus making the first gym easier to pass through.
Talking about fighting types, they have 5 strengths (its moves super effective), thus making it hard to defeat them. There are many fighting types also, thus giving the gym leaders a good combo. Ground types aren't there much despite of its 5 strength because of lack of variety.
I'm comparing Rock and Fighting types to Ground types because even they have the potential to become like these types, but the mentioned drawbacks pull them back.
Also, as everyone said, Game Freak wanted it that way!
Hope it helps!