To the OP:
Nothing per se will work, unless done correctly.
When learning technique through pieces, as for example learning a Mozart sonata (plenty of scales and arpeggios there) maybe despite doing it incorrectly technically/mecanically some people might argue you would get at least something "musical" out of it. You'd be honing your soul and ears. (Unless done so badly and getting frustrated that the student starts killing the music-which I have seen done before)
Other teachers will say that the music itself will lead you to the right gestures, to the correct technique. Whilst this would be the ideal scenario and I believe is the case in advance level students/pianists, it is in my opinion not what happens when the student's level is low or very low, and has no appropiante notion of his body and the piano.
This is why many teachers prefer to work with the students honing their mechanics and building up technique separately from working pieces. (It is easier to keep focus on the physical aspects rather than getting "lost" with the music- though some will find Hanon so boring, they will struggle to focus.. it all depends). Others have a combination of both.. It all depends.
Strictly to your question: Yes, it CAN work if done properly (that means you being diligent in your practice and your teacher giving you the correct instructions).
My advice in any case is, ask your teacher first, especially before asking in the forum, with all my due respets to other forum members, and that includes myself obvously. Ask always your teacher why and how. You are quite right in being inquisitive and wanting to know, nothing wrong with coming here to share your doubts etc, but ask your teacher first, give him the opportunity to explain you, and give him the credit he diserves as your teacher. (If he doesn't have credibility to your eyes as your mentor, you may be better working under someone else).
M