LivingAttackEvent would indeed be a better choice for this. For some reason I thought it was fired when a living entity attacked something rather than when a living entity is attacked by something.
You should be able to use e.source.getSourceOfDamage() to get the attacking Entity (like your original code), Entity#attackEntityFrom to attack the mob and Event#cancel to cancel the event (preventing the damage to the entity with the potion effect).
instanceof will simply return false if used with a null value, so you don't need to explicitly check for null before using it.