Where? No electrician is inspecting every house that goes up for sale in the US. Sure you can ask an electrician to inspect a house electrical… but that doesn’t bar a house sale anywhere I’ve ever seen.
But they do not remove the panel cover to look inside, nor do they open up any receptacle box anywhere to look at any of the wiring inside. So they wouldn't know (nor discover) if the wiring job was done well or done in a shoddy manner.
They won't stop you from selling the house as-is but some buyers will walk, some will demand you get it permitted, most will at least want a real inspection done. Getting as-built work permitted after the fact will cost 2-3x as much in permit costs than it would have if done properly, and it may require you to remove drywall to expose things for inspection, but as long as it meets code you won't have to rip everything out and have it redone by a licensed person. In most places you can do work on your own house, so it's the lack of permit that needs to be remedied.
I just sold a 120 year old house. “I don’t know” is a valid answer to the disclosure requirement but it better be true.
The city isn't in the business of busting doors and issuing citations if you replace kitchen cabinets without a permit. They basically act if someone credibly complains, which is mostly if you're doing some exterior additions / changes that annoy a neighbor.
Sure, if the odds are 50/50, or you go to jail, or the fines are $50k or something, then yeah, do it right from the start.
But if there's a 2% chance of getting caught, getting caught costs you 150%, and not getting caught costs you 10%...the choice is pretty obvious here, isn't it?