CPLD is (sometimes) not incrementing counter
Is the trigger input completely asynchronous to the 50MHz clock? If so, it probably violates the setup and hold time requirements from time to time. You need to synchronize it to the clock through at least two FFs before you use it in any decision making.

I can hear you saying, "But it's only used in one if statement. If the trigger_state gets updated, doesn't that guarantee that trigger_count gets updated, too?"

The answer is "no."

trigger_state and trigger_count represent a total of nine separate FFs, and each one of them has its own combinatorial logic to determine what its next state will be. Each one takes trigger as an input, and they each make an independent decision about what the value of trigger is. If you violate the setup/hold time requirements, you can no longer guarantee that those independent decisions will be consistent, leading to the behavior that you observe.

Note that this has nothing to do with metastability, although synchronizing asynchronous inputs mitigates that problem, too.