Thrown weapons (like a rock) are a special case of ranged attacks - if the weapon thrown is considered a melee weapon, you use the ability modifier you would have normally used in a melee attack, rather than automatically using dexterity - so, usually your strength modifier, unless fighting with a Finesse weapon. From the weapon properties in the basic rules:
Thrown. If a weapon has the thrown property, you can throw the weapon to make a ranged attack. If the weapon is a melee weapon, you use the same ability modifier for that attack roll and damage roll that you would use for a melee attack with the weapon. For example, if you throw a handaxe, you use your Strength, but if you throw a dagger, you can use either your Strength or your Dexterity, since the dagger has the finesse property.
It looks like the attack modifier for the ape's rock throw has been calculated as if it was a melee weapon being thrown, rather than an intrinsically ranged weapon, so the attack uses the strength modifier. Improving the ape's strength should benefit both attack modes.