This didn't help me (Lydia refusing to follow me, she just ignores the "Follow Me" command. Just reformatting text to make it readable:
To bring back the "Come with me" dialogue after dismissing Serana (or whichever companion giving you trouble),
enter the code sqv DLC1NPCMentalModel in the console.
You are given a long list of information. Scroll down the list using the page_up and Page_down and make sure that the following codes:
CanFollow_var = True
IsFollowing_var = False
IsWaiting_var = True
TurnOffComeWithMe_var = False
LockedIn_var = False
are in order by looking at the false/true (i.e., if LockedIn_var was set to true then you need to put it to false). To do this, enter the following command:
setpqv DLC1NPCMentalModel LockedIn_var False.
Once you do this you should be able to recruit Serana to be your follower again