The problem is the Order started to mess with Poland pretty much since its arrival to the land of Kulm. They forged documents giving them that territory forever and got pope's blessing for keeping it and conquering pagan lands in Prussia. The Order's guest (Margrave of Meissen) even captured and burned the capital of Masovia - Płock.
Since the order used the internal divisions between Polish duchies it would be good if Poland got stronger - let's say the Henry the Bearded (duke of Silesia) was not kidnapped by Konrad of Masovia - instead he managed to defeat him and unite Poland. His son, Henry II the Pious mannages to organize stronger defence against Mongolian invasion. He calls all Christian forces for help and the Teutonic Order responds. They do not want to anger a stronger Polish ruler and after all, it is their duty to fight pagans. A stronger army of Polish dukes, supported by the Teutonic Knights, Knight Templars,d Knights Hospitallers and some troops of Moravia manages to defeat Mongolian forces. Victorious Henry is proclaimed the King of Poland with full belssing of the Church which sees in him the defender of the Christian world while Polish people consider him the saviour of their country. The authority gained by Henry after his victory helps him to stabilize his power in Poland.
Strong, united Poland with excellent relations with the Church is not someone the Teutonic Order would like to make enemy of. Therefore the Order concentrates its effort in expanding to the east. Eventually Henry and his successors take conbtrol of Pomerelia, which gives them ability to cut off the Order from reinforcements from Germany. Another reason why the Order should not anger the Polish King.
Meanwhile eastern Poland is troubled by Lithuanian raids. Poland and the Order decide to eliminate this pagan threat together and launch a series of joint crusades against Lithuania. The deal is - the Order takes lands in the north, Poland in the south. The alliance is rather successful...