Sorry to hear about your dog, it can be awful when this happens. Dogs are such stoic creatures often they don't display any clear, visible signs before it is too late. I doubt very much you could have done anything to prevent it.
My beloved bulldog developed bloat and within 3 hours I had to have her put to sleep. I felt like I had been hit by a train. I'd had her for a year, and she was just turned 4.
I really feel for you and am so sorry this happened. I can't tell you I know what was the matter with him -I don't. But you couldn't have known he was about to die. You couldn't have guessed that. with just those two symptoms -which could have just been fleas, or allergies......
There obviously must have been a cause for the "tremors" he occasionally had. He could have had neurological issues you were not aware of. And sometimes dogs will lick and scratch at spots where they feel some pain. A sharp sudden pain will often get a dog licking at the spot. But you weren't to know that.
The problem is, dogs don't always show their troubles as clearly as humans do. They soldier on, and can sometimes die suddenly though having apparently shown few symptoms.
Try not to beat yourself up about this. You are devastated I know. But try to remember the good dog you knew.