This has actually happened to me a couple times. The first time it happened was after I got onto my 1.16 world after updating it to 1.17. I noticed that a lot of my villagers were missing or had the wrong trades. I was upset, but pinned it on the new update and moved on and made a second villager farm. This time, when I was playing today, I was just running around my world and I noticed that my some of my villagers had disappeared. All of my librarian villagers and one put of my three farmer villagers to be specific. Thankfully, as far as I can tell, I got all of the enchantment books I needed out of them, but it is still very disappointing. I spent a lot of time getting the right enchantments from them and it's disappointing to know that I will have to start over again. I'm not expecting you to replace my villagers, but I would really appreciate if you fix this bug so that this doesn't happen a third time.
Related issues
Comments

Thank you for your report!
We're tracking this issue in MCPE-21416, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki