Johann Joachim Quantz (1697 – 1773) was the court flutist and flute instructor for the King Frederick II (Friedrich der Große)of Prussia. Part of Quantz's job was to perform but he would have been also required to instruct the king on flute performance, provide him with flutes and also with music for performance. One of his principal contributions to music is a book that was written in 1752 entitled in English, "On Playing the Flute." This book is not only a flute tutor-type book for the Baroque Traverso but a historical reference for how music in general should be performed from that time period in history.
"The" G major Concerto that you are aware of is only one example of many pieces that Quantz composed. Musicians back during the Baroque/Style Galante/Roccoco periods more often than not weren't "specialists" in just performing. They were also composers. As an example, one source listed all of Quantz's known compositions and in that list are 28 different Concerto's in G major alone.
So the simple why? Because it was simply his job to provide entertainment and educational material for his King.
Hope that this helps.