I paid little attention to this, but yesterday I completed the Scourg Barrow quest for Princess Morgiah, and when I came back to Castle Wayrest, I discovered that both she and the royal couple were missing from the palace, whereas all other courtiers were in place. I rented a room in a tavern and waited for the next day, assuming that perhaps some rare mechanic was in place; this did not affect the issue at all. I travelled to a nearby town and then back to Wayrest in hopes of resetting the castle NPCs, but this did not work either. I exited the game to look up the forums here, but was not able to find info on this specific issue. Yet, when I restarted the game and loaded the latest save (attaching it here just in case) everything seemed to work fine and the royal family was back in the palace. Unfortunately I did not realise that they were not missing permanently and it did not occur to me to take screenshots and/or save the game while facing the empty throne room.
I'm playing with a bunch of (mostly) cosmetic mods (I'll give a list below) and I guess that one explanation would be that one of them is possibly causing this issue. However, I've not been able to reliably recreate this problem, making it hard to go through the mods turning them off one by one to determine the cause. It has occurred to me today that apparently, I've only observed missing NPCs in buildings where I was given a quest which was still pending, but I am not completely sure on that.
The mods I've got installed are (all the latest versions as of 26 Feb 2023):
Spoiler!