If the compromise of the machine could be turned into a permanent compromise) with the ability to manipulate the UI (which seems likely on mainstream Desktop OSs, you could use that to intercept the 2FA token on the next login, and use it to turn off 2FA.
The only way to prevent that would be making the token purpose bound, and displaying that purpose on the trusted 2FA device.
The only way to prevent that would be making the token purpose bound, and displaying that purpose on the trusted 2FA device.