Within the past 24 hours, I've just seen this same issue/quandry on another website - spring semester charges due by Jan 3, 2022 but making the withdrawal prior to then...in December 2021.
Obviously, by now you've likely paid the $3k penalty, but I would not have been so quick to do that. I believe that there are two key points you should have taken into account:
More than likely, the IRS would not have even noticed and not even flinched.
So long as you keep records and documentation of what you did, any inquiry from the IRS could be addressed and they would close the matter. The IRS is not unreasonable - they simply want you to pay what you are responsible for. There is the letter of the law, and the intent of the law. At many schools, spring tuition is due in December. Do all those families foot the bill from personal funds in December, and then make the 529 withdrawal paying themselves back after Jan 1? Highly unlikely.