This is a current technical limitation. Grammarly makes a lot of small changes to your document to display underlines and highlights, and those changes aren’t recognized by Microsoft Word as programmatic. Therefore, they end up in your “undo” and “change” history and pollute it. To avoid confusion and other potential technical issues, Grammarly will disable your "undo" history while your checking session is in progress. You are advised to disable the Track Changes feature by yourself.
Please note that while Grammarly is enabled, not only is the Undo button not working, but the "undo" history is also not kept. This means that any changes made to the document while Grammarly is active cannot be undone even after you disable Grammarly. However, after Grammarly is disabled, all further changes to the document can be undone with the native Undo button.