After testing I found out that villagers seem to lose their "minecraft:job_site" memory under certain conditions. One of those conditions seems to be exhausing their trade option at night.
I created an enclosed room with a bed and brewing stand in center. Created a villager in creative mode and vaited until he claims the stand. Trade zombie flesh at day until trade is locked → restocked normally, memories intact, RestocksToday is 1.
Awakened him at night and traded until zombie meat trade is blocked again. Waited about 10 minutes → "minecraft:job_site" memory is gone from his entity data, RestocksToday is still 1.
After testing I found out that villagers seem to lose their "minecraft:job_site" memory under certain conditions. One of those conditions seems to be exhausing their trade option at night.
I created an enclosed room with a bed and brewing stand in center. Created a villager in creative mode and vaited until he claims the stand. Trade zombie flesh at day until trade is locked → restocked normally, memories intact, RestocksToday is 1.
Awakened him at night and traded until zombie meat trade is blocked again. Waited about 10 minutes → "minecraft:job_site" memory is gone from his entity data, RestocksToday is still 1.
Example of memories of affected villager: