You can prevent villagers from moving when you're taking a break. I dislike that they'll move if you haven't played the game in a while (I don't mind the other effects like weeds but villagers moving out just like that isn't a great feature) but there's a way around it at least. On the day that you're planning on taking a break, deny a villager's request to move. The next time you play, nobody will have moved out even if it's been a long time. A method I use to move villagers out is even based on something like this and in it I've skipped years without villagers leaving because of having denied their request on my last saved day.
Also, if you didn't plan for it and so didn't make a point to ask a villager to stay when you last played or nobody pinged you, you can also keep your villagers. Whenever I take breaks, I just set the 3DS clock to the day I last played (you can check when it was using the activity log) and then go day by day until I reach the present or someone asks me to move. If you don' want to mess up your activity log, you can always start the game on the day you're returning using a new character. When Porter gives you the map, check if anyone's missing. If you want to be extra save, go visit the houses and check if anyone's in boxes. Don't save. After you're done checking, quit, set the 3DS calendar back to when you last played, and unless there's an event coming up or you have 8 or less villagers, the villager who was missing in the present will ping you. If they don't ping, talk to them. If they still say nothing about moving, just save and quit and go talk to them again. Once they ask you to move, tell them to stay and just go set your 3DS calendar back to the present day. Nobody will be gone
Basically, the danger is mainly if before you took the break you didn't ask anyone to stay and then load the game as your mayor the first time you go back.