If someone is waiting for almost two years for a response from IRCC for restoration of study permit, been working illegally, would your opinion be to consult a lawyer, and leave BEFORE a decision comes. If person wants to ever return to Canada?
If you want to just leave, you can do that, no questions are asked as long as you have proper documentation to travel, i.e. passport of the country you are travelling to or appropriate visas. Also, if there is no outstanding warrants against you, you will not be stopped.
However, if you plan to return to Canada, in the future, then you should contact an immigration lawyer to have this resolved before you leave.
Be advised that consultants cannot advise you or help you, only a lawyer can, as you may have to file a case before the IRB or Federal Court, as the case may be. This will be case specific situation, which only a lawyer can tell you.
Instead of canvassing suggestions and pinion on a public forum, talk to a lawyer. IF you do not have enough money, you can visit an immigration clinic
Law clinics are run by law students or volunteer lawyers and are located across Canada, especially in and around law schools.
Also, some volunteer organizations also provide legal assistance
See
http://www.migrantworkersalliance.org/wp-content/uploads/2011/05/LICG-mwac.pdf
They will be able to evaluate your case, and documents and provide you with the right advice. The forum can only point you to the resources, but without evaluating your documents, and your precise immigration scenario, it is difficult to give a conclusive answer, especially under your circumstances.
You can google law clinics and you can get the list of those close to you. Due to COVID, some clinics may not be open, but they will let you know when to contact them.
Hope this helps.