I think I may be reading between the lines here but I don't think Pep ever intended to sell Hart originally.
I think when Pep first arrived he told Hart that he doesn't have any plans for him as of yet and he will be finding a replacement, I think then Hart has kicked up a fuss and obviously said something which caused Pep to take a disliking to Harts attitude or in this case "Personality" (remember when Pep said Willy's personality was better than Harts?), I think then Pep decided to play Willy as a lesson to other players that you do as you're told or you'll be easily replaced.
Deep down Pep knows Hart is a good goalkeeper and that he's better than Willy, but watching Hart for so long he does have a lot of pride, and I wouldn't be surprised that he's said something out of turn to Pep for denting his pride (especially on the back front of a poor Euros).
It'll be a shame to see him go as I was hoping he'd break the appearance record for us, but I'd hate to see him stay if it's just going to cause unrest in the dressing room and bad tension.