Your two exact correct sentences are explained well on the Cambridge Dictionary website, which I found by using Google. It's a very good read, and I learnt some things from reading it despite English being my first language.
Taken from the website, "when a clause with neither or nor is used after a negative clause, we invert the subject and the verb after neither and nor." Looking at your two first sentences:
He hadn’t done any homework, neither had he brought any of his books to class.
We didn’t get to see the castle, nor did we see the cathedral.
"He" and "had" were inversed after a negative clause in your first sentence, and "we" and "did" were inverted in your second sentence.
Whilst there are other situations in which "neither" and "nor" can be used, none of them apply for your three incorrect sentences.
"Nor" either follows a negative clause as explained above, or it follows "neither." Neither are the case for your second and third sentences. When the criteria for "nor" are not met, "or" should be used instead:
I haven’t been to the US or the UK.
Santa will not permit naughty behavior or even consider bringing presents.
"Neither" can be seen as a combination of the words "not" and "either." In your incorrect first sentence, you have already used "not" as part of "haven't;" this invalidates using "neither." To correct the sentence, you would either write:
I have been neither to the US nor the UK.
(Removed "not" from "haven't", so it now makes sense to use "neither." As "neither" has been used, it is also appropriate to use "nor.")
– or you would write:
I haven't been to the US or the UK.
(Removed "neither" and "nor.")