Does a creature know that it is the target of a perceptible attack before the attack resolves?

Making an attack has the following structure:

  1. Choose a target.
  2. Determine modifiers.
  3. Resolve the attack (typically as a hit or miss)

At what point in this sequence does the target of the attack realize that they are being attacked?

The rules for spell targets (PHB p.204) indicate that the target realizes it is a target only if the effects of the spell are perceptible, but does not say during what step that knowledge is gained:

Targets Unless a spell has a perceptible effect, a creature might not know it was targeted by a spell at all. An effect like crackling lightning is obvious, but a more subtle effect, such as an attempt to read a creature’s thoughts, typically goes unnoticed, unless a spell says otherwise.

However, the target of a magic missile spell clearly knows that it is a target during Step 1, at least as long as it could respond with a Shield spell:

Casting Time: 1 Reaction, which you take when you are hit by an attack or targeted by the magic missile spell

The rules for noticing a Hidden Attacker imply that the target realizes it is under attack only in Step 3, since it is then, and not before, that the attacker gives away their location (PHB 195):

If you are hidden—both unseen and unheard—when you make an attack, you give away your location when the attack hits or misses.

However, it is not clear whether the target of the attack would notice the attack sooner, perhaps in Step 1, were the attacker not Hidden. Furthermore, some abilities that permit a response to being targeted require being able to see the attacker (see below).

Under certain circumstances, a creature can notice it or another creature is the target of an attack and respond before the attack hits or misses.

A goblin boss (MM 166) may use Redirect Attack as a Reaction:

When a creature the goblin can see targets it with an attack, the goblin chooses another goblin within 5 feet of it. The two goblins swap places, and the chosen goblin becomes the target instead.

A creature with the Protection Fighting Style (PHB 72) may respond as a Reaction to an attack on another target before the attack hits:

When a creature you can see attacks a target other than you that is within 5 feet of you, you can use your reaction to impose disadvantage on the attack roll. You must be wielding a shield.

A creature with the Mounted Combatant Feat (PHB 168) may respond to its mount being targeted, and does not even have to use its Reaction or see the attacker to do so:

You can force an attack targeted at your mount to target you instead.

It is not clear to me whether all creatures generally know that they or others are being targeted by perceptible attacks in Step 1, and the specific circumstances (boss, feat, spell, style) only allow them to respond in certain ways to that knowledge, or whether creatures generally do not know that they are being targeted, and the specific circumstances permit both the knowledge of the targeting and the ability to respond to that knowledge.

This distinction might be important if the GM allows other, non-specific reactions in the case that a creature knows that it or another is being targeted before the attack resolves.

Does a creature generally know that it is being targeted by a perceptible attack without a specific feature that permits that knowledge?