The elephant can still make its bonus-action stomp attack if it meets the other requirements for Trampling Charge
Jeremy Crawford, rules designer for 5e, answered a similar line of questions on Twitter about the Lion's Pounce ability, which works similarly:
a lion Pounces on its target, target fails save and falls prone. can the lion immediately use its bonus action bite attack?
That's exactly what its Pounce trait lets it do.
thank you for fast reply! we initially ruled that lion needed to pounce on an already prone target to get the bonus attack.
A lion can make the bonus attack in either case.
but only those two cases, right? lion cannot bonus action bite a prone target unless he runs 20ft and Pounces?
Correct. The target in the final sentence is the same target as in the previous sentences.
For reference, the lion's Pounce trait says:
Pounce. If the lion moves at least 20 feet straight toward a creature and then hits it with a claw attack on the same turn, that target must succeed on a DC 13 Strength saving throw or be knocked prone. If the target is prone, the lion can make one bite attack against it as a bonus action.
As you can see, it's nearly identical to the elephant's Trampling Charge:
Trampling Charge. If the elephant moves at least 20 feet straight toward a creature and then hits it with a gore attack on the same turn, that target must succeed on a DC 12 Strength saving throw or be knocked prone. If the target is prone, the elephant can make one stomp attack against it as a bonus action.
Crawford's responses make it clear that whether or not the target is already prone (or, by implication, even if the target is knocked prone through some other means), the elephant could only make a bonus-action stomp attack per the Trampling Charge trait if it met the other conditions for it - namely:
If the elephant moves at least 20 feet straight toward a creature and then hits it with a gore attack on the same turn
If the elephant moves in that manner and hits the target with a gore attack accordingly, then it can make a bonus-action stomp attack against that same target as long as the target is prone at the time of that bonus-action attack. If these conditions are not met, no part of the trait can be applied.
A final note: The lion can choose to either make a Bite attack or a Claw attack as its action, with no targeting restrictions. However, the same is not true of the Elephant:
Gore. Melee Weapon Attack: +8 to hit, reach 5 ft., one target. Hit: 19 (3d8 + 6) piercing damage.
Stomp. Melee Weapon Attack: +8 to hit, reach 5 ft., one prone creature. Hit: 22 (3d10 + 6) bludgeoning damage.
As you can see by the section I've bolded, the elephant can only use its Stomp attack against a prone creature. As such, if the creature is not prone to begin with, the elephant's only attack option is the Gore attack.