It is a great idea and perfect for the student that enjoys this creativity. You cannot give it to ALL students because some are not interested in composition and just want to learn to play the instrument. Also many beginner students have much more important tasks to complete before they should go about learning to compose anything. Learning how their fingers work, coordination, sight reading, technique, expression etc, these should be learned from professional compositions. The more experience the student has with good writing the more they will naturally understand perhaps how to do it themselves, however trying to teach how to write before they have read multiple works and learned to play them seems backwards for most students.
There are particular students who are much more inventive and creative compared to other students and I think teaching them to "invent" can be beneficial. I would think that the creative side should be tied into other important aspects of learning, for example you could ask them to compose something in a particular key and what highlights a particular technique they have experienced in another piece. The problem with inventive students is that they can sometimes become overly interested in their own creations and invest too much time, where they should be focused on the standard learning tools which will help them become more creative in the future.
All students however are asked to invent ideas perhaps not compositions as such when they are learning pieces. A beginner going off and teaching themselves passages may have to experiment with fingering and movement options and try to discover what feels the best and why. They also will to do the same with sound, what sounds better and why. So we are always asked creative questions when learning a musical instrument and the solution needs to be one that reflects us investigating the issue on our own terms.
"On our own terms" means a student learns understanding things that they can explain to themselves based on their past/present knowledge. Those that attempt to learn a musical instrument like a parrot type non-intelligent mimicing tend to not have an explainable understanding of what they are actually doing are often mistaken to not having learned something on their terms, but they actually have, it is just displayed as raw muscular memory (I say "raw" because they may not understand the application of the muscular memory when they come across it in another piece and need to be spoonfed the information before they can make that connection that they have past experience associated with the task). I find it very important as a teacher to try and encourage the student to be inventive with these muscular memory tools, so we should encourage the student to create exercises and patterns over the piano which highlight technique they have learned, if only it makes them observe it in new pieces at least they understand how to apply past knowledge.
Some very young students learn best with this parrot learning which is not suprising, they merely understand what they are doing based on the muscular memory and sound associated with their actions. They do not need to connect a logic or conscious understanding of exactly the patterns they are creating and how it relates to their overall musical knowledge although getting them to sometimes explain it in words can yeild facinating answers!
Musical games for the young children encourages thinking, whether it is strategical, inventive or guesswork, they have to make decisions themselves and face challenges on their own (with the teachers assistance as required). So all in all I think that inventive thinking is something that exists in all musical lessons, the student needs to be able to invent a solution to deal with learning a new piece. if they approach every piece without trying to invent solutions then they are dealing with learning everything as if it was all completely new material. Unfortunately this is a limiting issue in students progress, some simply cannot apply past knowledge or there is a saturation point where they can no longer control all their past knowledge to learn "harder" pieces that build upon their knowledge. Once a student reaches a saturation the teacher needs to consolidate what the student has learned, that is make stronger what they know, make it more routine and natural for them. If a teacher notices this saturation in the student they getting them to take a more creative approach to their learning, composing, improvising, inventing paterns/exercises etc can solidify their current knowledge.