Generally it's not a problem. Unauthorized work isn't normally something that triggers inadmissibility all in itself, it normally is just a bar to adjustment of status and only adjustment of status, so you generally can still leave and undergo consular processing. Of note is that it's not a bar for AOS for immediate relatives of US Citizens (spouses, parents, unmarried children under 21).
Only related things that trigger inadmissibilities are:
Fraud in somewhere in the immigration process, like you lie to the DOS during a consular interview, lie at port of entry to the CBP, or lie to USCIS while seeking something in US (which triggers a misrepresentation bar that can be waived with an I-601).
Falsely claiming to be a US Citizen in any context, even in a private casual conversation (which triggers a false claim of citizenship bar at point of which you are utterly screwed).
Lying otherwise (e.g. falsely claiming to be an LPR on an I-9, or using a wholly made up SSN) do not trigger anything here. So you know, in your case since you just worked under the table, own up to it, file and pay off the back taxes, and you'll be fine.