I have now found that if I add a new category in WordPress I can’t add it to my posts. For example I have added the top level category “Trains” and a category beneath that “Wrapped Trains”:

However if I try to select “Wrapped Trains” it isn’t in the list of categories:

In fact before I applied the below work around even “Trains” didn’t appear.
FYI: I was running PHP 7.3 although 7.4 was the recommended. Otherwise all up to date. This was done 6/11/2022
Workaround
From “Posts | All Posts” select the post in question

Then, under “Bulk actions” select “Edit” and click Apply

In the edit screen select the category you want, “Wrapped Trains” and then “Update”

Refresh your post and you should find the new category selected:

You will now also find that the category is now available for new posts.
Things tried
Before the above workaround was done I had unsuccessfully tried:
- Hard refresh of the browser
- Restarting the host the web server ran on
- Creating a new post – the category was displayed
- Deleting and recreated the category