You deal the extra damage if you hit with the second attack only
I don’t know if there’s that much to explain here, you’ve pretty much laid out the reasoning in the question itself. The feature specifies it grants an extra attack, and allows you to deal extra damage if you hit with that attack. I can’t see any ambiguity there. It seems you don’t really seem much ambiguity in there either, rather it appears to me your concern isn’t whether or not this is RAW (which it obviously is), but whether or not that’s “too weak”.
Simple answer to that question: No. Statistically the main benefit of this feature is the extra attack itself, not the extra damage. The fact that something might interrupt you between your attacks is, at best, academic because this is almost never going to come up (you very infrequently run into enemies that can do anything at all as a reaction to being attacked, even rarer anything that’d actually interrupt you rather than just being annoying).
What you seem to be forgetting in your analysis is that your first attack can also miss and the second one could hit, leading to our gloom stalker doing quite a bit of damage whereas hypothetical other rangers wouldn’t have accomplished anything.
Let’s compare that to the features you have listed (assuming using a longbow and 16 Dex for simplicity), for first turn damage:
- Dread Ambusher: You get an extra attack on your first turn for free, as long as you use the attack action (which is most of time what you want to do anyway). If both hit, that’s
1d8+3 + 1d8+3 + 1d8, for an average of 19.5 damage. If you have Hunters Mark up (which you can because this extra attack doesn’t use your bonus action) that adds an extra
2d6 for an average of 26.5 damage. If only one attack hits that’s still either 7.5 or 12 average damage, depending on whether or not the second attack hit, or 11/15.5 respectively with Hunters Mark.
- Colussus Slayer: You only have one attack. That’ll do 7.5 or 12 average damage if it hits, depending on whether or not your target is damaged already - or 11/15.5 if you’ve activated Hunters Mark. But you also have a much higher chance of not hitting at all, depending on the AC of the target of course.
- Planar Warrior This uses your bonus action, so you’ll have to choose between using that and Hunters Mark, so we end up with 11 or 12 average damage if you hit depending on which you chose, and again a much higher chance of not hitting at all. This doesn’t really get any better in the following turns, where you keep having to make the choice of giving up your bonus action for a bit of extra damage which other rangers can make better use of (Crossbow Expert, Two Weapon Fighting, a bunch of ranger spells are bonus actions etc).
As you can see for the first turn the Gloom Stalker actually has a significant advantage. It’s actually Planar Warrior which has a hard time keeping up (though other Horizon Walker features somewhat make up for that). The situation changes a little with with higher levels, as attacking thrice instead of twice is a smaller advantage, but it’s still pretty good (especially taking magic items with on-hit effects, or even just plain attack + damage bonuses into consideration). Planar Warrior gets worse here as its only good for one attack. Colussus Slayer pulls ahead in longer battles with tougher enemies, whereas the Gloom Stalker remains pretty good at what it does - either taking out a bunch of smaller enemies, or focusing down one tougher enemy before they have much of a chance to act (keeping in mind that in practice few combats last more than a couple of turns, so being very strong in one turn can be better than being pretty good consistently depending on the circumstances).
This is in addition to the fact that you’ve kinda ignored the initiative bonus you get from the feature, which is very relevant - again, the faster you kill your enemies the less of a chance they have to kill you, so it’s hardly a ribbon feature you should just ignore.
TL;DR: You’re focusing too much on the 1d8 extra damage and significantly underestimate the value of getting an extra attack, and the cost of having to use a bonus action.