My thought was that Gold looked at the dagger as his back door. If, after the war, he hasn’t found Bae, he can retrieve the dagger, return to one of the realms with magic, and resume his search. When he gave the dagger to “Bae” it was a way of saying he would never pursue magic again, that the only reason he had hung onto the magic was to find Bae.