I have been analyzing the pterosaurs to see if they actually had beaks as we use the term "beak". Rhamphorhynchoid stands for "prow beaks". This kind of "beak" is not the extending kind of beak that we associate with the word "beak".
When the pterosaurs evolved into primitive birds, it may well be that the most basal primitive "beakless" birds had snouts, like prow-beaked pterosaurs.
And "beaks", as we use the word, evolved within the primitive birds.
This idea is in line with the fossil record.
This idea requires more analysis but it seems right to me at this point.