Microscopic mechanism of imprint in hafnium oxide-based ferroelectrics