It's not whether they find out or not, the real issue is that most employers have a "waiting window" for new H1B hires. Nothing stops you from moving to a new company but you will have to put in that initial time (which many HR heads blame the legal team for taking a long time, and in many cases the legal team can "lose" your paperwork or it can get rejected on technicality due to a law change). So this has nothing to do with you (as employee), but more to do with profits. While you are in this waiting period you will work hard and I have seen people pretty much live at work. This is pretty much indentured servitude. And if they don't like it they can leave anytime, and start this process again with still no guarantee that they will get a green card. People in charge (usually head of HR and whoever is doing payroll/finance, CFO or CIO depending on company), know that they are getting a good thing, why not get the most of it.
I have worked in this industry for over 3 decades and met many good people who were stuck in this process, some lucky ones got their green cards after 5 years because they were very good (and often had to threaten leaving to "hurry" the legal process) and the company could not afford to lose them. I have worked with people who were on it for over 10 years and some just went back home because they got tired of the hours and low pay and missed their families; QA, support and IT people had it worst, as they were worked for very long hours and I felt that there was no urgency to get them green cards because they could be easily replaced. Software developers (especially good ones) had a significantly easier time.
It's a well intentioned system that as always gets abused for profit.