If you try locking in a villager by doing a single trade then break workstation they turn back into brown coats, then will relink if you put workstation back down. After relinking the villager will be automatically locked into whatever random trades generated when they relinked. Sometimes it doesn't even matter if you level it to apprentice+, it still resets. Had one with looting3 leveled up to apprentice and went today to get it once I had emeralds, and he was a bookshelf trader that was already leveled to apprentice.
Related issues
Comments

Thank you for your report!
We're tracking this issue in MCPE-117852, 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