Villagers will change their profession even after having their trades and profession "locked." the profession chosen by the villager (randomly chosen from nearby workstations) is then locked, along with the trades.
example: a librarian villager with a mending book trade (in a personal world) randomly changed into a farmer, and regardless if the workstation is placed or not. the profession was not able to be changed back, but the exp from the librarian was kept.
Related issues
Comments

Thank you for your report!
We're actually already tracking this issue at MCPE-62080, so I will resolve and link this ticket 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:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki