We play on Xbox one in our Microsoft Realm, currently upgraded to 1.16.1. This bug has been seen off and on for almost a year now.
When we encounter a town we 'save' it, but putting up walls, making sure that there are enough employment blocks and making improvements (bigger library, larger farms etc.). We build a house for us to sleep in while we are there, and put it either 20+ blocks up from the highest point of the town, or 20+ blocks below (in order to keep any villagers from claiming our beds using their 16 block detection range). In many towns we then experience a situatione where we have gone away to explore or build or something, and when we come back there are more vilagers than beds in the town....sometimes TWICE as many villagers as beds in the town. Some of the villagers that we traded with and got to max level are still there, but some are not. Some of the 'new' villagers are now level one in their professions, and others are just unemployed.