There are a load of commands to process and it all gets muddled up with all that falling sand. So it would take around 1-3 hrs. Unless you want us to start from scratch with concepts in mind.
The commands are relatively simple, with just using /execute as and /fill
Someone make a datapack for this, I have school and not much time ty
There are only 3 main commands that are needed, the rest is just to construct the command block system that runs it all.
The tnt summons an armor stand, the armor stand fills the area with glass, the tnt makes a hole in the glass, the hole gets filled with stone and the glass gets replaced with air. I couldn't get the timing right but the concept is here.