I have a pretty barebones site called drawclip.net, where you can sketch something, export it, save your progress into your browser's local storage, and rewind the sketch. It doesn't have the fillingfill or paste function yet, and creates a translucent grey filter over the whole area (it wasn't meant for the specific purpose the OP had in mind), but should do the job well enough.
Work on the puzzle there, draw whatever you want.
When you're finished, set up the built-in XBox Game Bar (enable it if you haven't already from Settings -> Gaming, and enable recording from Gaming -> Captures), and open it. I recommend creating shortcuts to open the Bar and start/stop recording so that you don't have to click and activate Windows Explorer (it led to the recording feature not working on my browser in my experience).
Start recording, then click the rewind button on the page. When the animation ends, stop recording.
Find your video from Users/[Username]/Videos/Captures and convert it to GIF from somewhere like this.
PS. re: 4, ezgif.com offers much more control over the end product, but shrinks the video too much while creating GIFs, and the APNGs (animated PNG) it creates don't work on this site (they animate just fine anywhere else) unless you edit (crop, resize, mute etc.) the video first and then optimize the APNG: