In the minecraft wiki page Chunk Format, it says for Villager:
CareerLevel: The current level of this villager's trading options. Influences the trading options generated by the villager; if it is greater than their career's maximum level, no new offers are generated. Increments when a trade causes offers to be refreshed. If 0, the next trade to do this will assign a new Career and set CareerLevel to 1. Set to a high enough level and there will be no new trades to release (Career must be set to 1 or above).
I used this code and after trading an acacia wood door for an acacia wood fence, the villager still leveled up and gained all their possible non-custom trades: