What if Caesar had formed an alliance with Ptolemy upon receiving Pompey's head, like Ptolemy had originally intended?
It was not in Caesar's interest, neither on roman politics, nor on personal/provincial strategy.
If one had been able to poll the roman people in the last weeks of the year 50 BCE, one would have found that 99% of the roman citizens considered that both Pompey and Caesar were national heros and that the greatness of their achievements qualified them for both being the first citizens in Rome, that both should stay political allies and friends and fix what had to be fixed in the roman republic and in the roman provinces.
And Caesar, more than anybody else (in which he was a nice exception), wanted clemency towards and reconciliation to prevail with his political enemies.
If Caesar had shown any gratitude to Ptolemy for killing Pompey, he would have been criticized as a barbarian and a monster, as un-roman. And, knowing that his political enemies had the strongest echo in the roman society and that he needed to win them back, he did not want to act so.
I don't mean that Caesar was not satisfied by Pompey's death which was rather opportune for him. But whatever he felf, at no cost could Caesar show any satisfaction for Pompey's death.
Concerning the personal/provincial strategy, no roman imperator could tolerate that a client king killed such an important man as Pompey on his own initiative. Any roman imperator felt an interest in warning clients against such kind of betrayals. A roman patron could suffer setbacks and could not tolerate his clients to try murdering him at the first setback.
And, at last, Ptolemy and his advisors were very stupid. They should have struck a deal with Caesar before doing anything against Pompey. Egypt at that time was something like the arabic peninsula today : the richest kingdom of the world with immense strategic agricultural ressources. They had to put their resources at Caesar's disposal. And they should have known that, Rome (and Caesar personally) having turned around the egyptian jackpot for almost 20 years, it was going to demand a lot in a time of civil war when it badly needed funds and resources.
Their idea was to give little to Caesar in hope he would quickly leave for other places were the civil war called hom. Total miscaculation : Caesar's goal was to secure strategic places and resources that had previously been at the service of Pompey and his republican/optimate allies.
Caesar had in fact already began negotiations with Cleopatra before arriving to Egypt. That's why he had her introduced in the palace in the famous carpet.
His goal obviously was to secure the tightest control over Egypt. And for this, I would even say that there was no better candidate than a woman. A woman was the weakest puppet a roman patron could hope for.
And Ptolemy had shown he was not trustable.