Very cool idea! We actually built something very similar for the CS course I teach at Illinois. Example: https://cs125.cs.illinois.edu/lessons/asserting/#switch . We've built this on top of Ace, which allows us to deliver lessons that have a mix of text, playgrounds, and these interactive walkthroughs. Overall I think that this is a great direction. Glad to see others working on it!
You have my eternal gratitude for all your hard work.