Yep, it's legal, by the book.
-Everyone was outside the penalty area until the ball was kicked, and then the teammate rushed in.
-The ball was played forward. (Nobody said it has to be played all the way to the goal!)
-The kicker did not touch the ball a second time until after another player touched it.
-The original kicker wasn't offsides on the pass, since he was behind the ball when it was played to him.

Sneaky and really unorthodox, yeah...but legal. I'd be interested to see how most officials at the high school level would react to seeing that, though!