I actually did this in one of my re-runs of Emerald. Forgot that Trick House existed and played through the game.
Post game I went back, and started the puzzles from the first onwards. The moment I finished one, I walked back in, and voila! The second awaited me. I finished that one, and re-entered the Trick House and the third puzzld awaited me. This continued till I finished all the puzzles.
So to sum (haha) it up, it doesn't matter. The game still goes by order, and you can finish an earlier puzzle even if you got another gym badge.
Source: Personal Experience