Not every challenge in D&D is overcome by sticking a sword in it
Some are overcome by avoiding them, negotiating with them, working with them or running away from them.
Know what CR is
From the Monster Manual (p. 9, my emphasis):
A monster's challenge rating tells you how great a
threat the monster is. An appropriately equipped and
well-rested party of four adventurers should be able to
defeat a monster that has a challenge rating equal to its
level without suffering any deaths.
An appropriately equipped and well-rested 4th or 5th level party should be able to defeat (not necessarily kill) a ghost or night hag respectively without losing anyone. A monster eliminated in combat has clearly been defeated: but so has a ghost that has been laid to rest or a hag that has been out-bargained.
"Appropriately equipped" includes being equipped with relevant knowledge.
A party that with no knowledge or preparation charges a ghost or a hag with malice aforethought deserve to go home in a bucket. This ain't no Ettin or Hill Giant - this is a thinking person's monster. If that doesn't suit your playstyle (which is fine) then don't use these monsters.
How to beat a ghost
The first thing a party confronted by a ghost needs to do is work out why its here:
Unfinished Business. A ghost yearns to complete
some unresolved task from its life. ...
The surest way to rid an area of a ghost is to resolve
its unfinished business.
Alternatively, they should be looking for its weakness:
A ghost can be destroyed more easily by invoking a weakness tied to its former life.
The ghost of a person tortured to death might be killed
again by the implements of that torture. The ghost of a
gardener might become more vulnerable when exposed
to a potent floral fragrance.
A ghost is very thematic monster - a DM should not be plonking them down to create a combat encounter; that's what Ettins are for. A ghost is a role-play and investigation challenge. For example, from Rise of Tiamat:
Ilda is a neutral good ghost who was once one of Diderius’s apprentices. She worshiped her master, but was mistakenly banished as a thief when one of his prize tomes was misplaced. Ilda died not long after Diderius, and her spirit returned here to act as caretaker to his great stores of knowledge.
Ilda is not violent except to those who would steal from Diderius. She manifests when the characters enter this area, demanding to know why they have come and threatening them if they plan to loot the library. If the characters point out that there’s nothing left in the library to steal, Ilda is overcome by a fit of misery as she agonizes over her failures. A successful DC 14 Intelligence (Religion) check reveals that Ilda can be released from her sojourn here if any volumes from the lost library are returned (see area 11).
Notwithstanding, if you do end up in combat with a Ghost they are not hard to defeat. An Ethereal Ghost is a harmless ghost since "it can't affect or be affected by anything on the other plane". If it wants to hurt you it has to put itself in a situation where you can hurt it. Further, coming from the Ethereal plane uses its one and only action - everyone in the party can do something before it can do any harm.
As for being "immune to nearly everything, ever" - they are only immune to 3 types of damage and they are pretty obvious which ones those would be. They are resistant to a lot of things but they have relatively low hp so even if you are only doing half damage you will get there eventually.
Horrifying Visage isn't going to kill you (probably) - you need an 8 or more to avoid its aging effect and aging 10-40 years is not a death sentence anyway. For a young human death definitely requires 2 fails and probably 3-4. A party of 4 wailing on a ghost while it does this has it dead in 2-3 rounds - the odds are with the party.
How to beat a Night Hag
Sell a little bit of your soul: surely you don't need all of your humanity and you can outsmart a hag, can't you?
Dark Bargains. Arrogant to a fault, hags believe
themselves to be the most cunning of creatures, and
they treat all others as inferior. Even so, a hag is open
to dealing with mortals as long as those mortals show
the proper respect and deference. Over their long lives,
hags accumulate much knowledge of local lore, dark
creatures, and magic, which they are pleased to sell.
Hags enjoy watching mortals bring about their own
downfa ll, and a bargain with a hag is always dangerous.
The terms of such bargains typically involve demands
to compromise principles or give up something dear especially
if the thing lost diminishes or negates the
knowledge gained through the bargain.
Sly and subversive, night hags want to see the virtuous
turn to villainy: love turned into obsession, kindness
turned to hate, devotion to disregard, and generosity
to selfishness. Night hags take perverse joy in
Of course, the real issue is that you probably never know you are dealing with a night hag due to her Change Shape ability and that's just the way she likes it. Nevermind, losing your integrity isn't going to kill you.
Fighting a hag is tough but doable:
They have no damage immunities and less resistances that the ghost - albeit these are resistances to the most common types of PC damage. Still, force, radiant and thunder damage should be available and an "appropriately equipped" 5th level party should have a few silvered weapons.
Just as with a ghost an Ethereal hag is a (mostly) harmless hag - I'll get back to Nightmare Haunting in a sec.
You say "can bypass any magic or protection" - huh? Where does that come from? Its not in my Monster Manual.
Also, "has a large array of powerful spells" - they have 5 and, with the exception of Plane Shift (which is not combat oriented) they are all cantrips or first level spells.
What you most definitely do not want to do is leave and angry night hag alive. However, while Nightmare Haunting sucks, you get individual immunity from the first level spell protection from evil and good and collective immunity from a third level magic circle. After that its a question of either getting out of the hag's territory or hunting her down. After that, you just have to find yourself a 9th level cleric and buy a greater restoration or two.
Of course, unless you are evil, the hag probably doesn't want to kill you, either in combat or through Nightmare Haunting - they just want to get you to the point where you are willing to bargain to just make it stop! Which brings us back to step 1 ...
How are they going to figure it out unless they metagame and read the Monster Manual?
- Ask around
- Consult a sage
- Visit a library
- Consult a cleric
Hags and ghosts are real things in the world. People know stuff about real things.