First, OPT is not a visa. Optional Practical Training participants are mostly F-1 visa holders. Per IRS rules[1], the social security tax exemption "does not apply to F-1,J-1,M-1, or Q-1/Q-2 nonimmigrants who become resident aliens." And per IRS rules [2], you are considered a resident aliens if you pass the Substantial Presence Test [3], which states, "31 days during the current year, and 183 days during the 3-year period that includes the current year and the 2 years immediately before that." Now how many students can get an OPT job and still fail this test?
The US immigration policy is not perfect and has holes. But attracting foreign talents to stay and work in the US is the baby, not the bath water.
[1] https://www.irs.gov/individuals/international-taxpayers/fore... [2] https://www.irs.gov/individuals/international-taxpayers/dete... [3] https://www.irs.gov/individuals/international-taxpayers/subs...