It’s definitely illegal - you will be fined a fixed amount for each day and immigration stamp your passport as an overstay. (It’s difficult to say what impact that can have in future)
The more serious risk is that you are stopped by police while overstaying your visa. You could be detained in immigration detention as an illegal immigrant.
The sensible option is to extend the visa - but as you have mentioned flying out that will also solve the issue.