@babuchas01 Hello! I tested with a few of the NPCs with roles and I found that just editing NPC sims in CAS did not strip them of their roles. First, I used testing cheats to modify Sarah Scott in CAS. I also used manage households to modify her. Both times, she kept her title as the Pub Owner. I also edited a couple of the Sages from Realm of Magic and both kept their Sage roles. Editing did move them to "my households" though. As for the hermit, this character is randomly generated at the start of every new save and quite possibly you will see a new hermit any time you start a new game. This likely means the hermit sim has a different set of rules where assigned roles are concerned. I did not test for librarians and DJs but I think will be treated similarly.
I'm sorry I can't speak to your personal experiences with these NPCs. I'm just not seeing the same issues in my game. In general, if you want to continue seeing the same sims fill these roles, I simply suggest not editing them and most certainly don't load and play them. That will surely strip them of their roles.