There's also "back channel" references. If there are some red flags but someone at the hiring company knows someone who worked with that person, they often reach out to get feedback from someone who worked with the candidate directly.
Many companies do this during early stage interviews to see if they should continue. They're not official references by any means but pretty common in a small community like the Bay Area tech industry.
You are correct. It's not just "if they're smart" it's "if they're complying with the law."
Former employers are only legally allowed to confirm employment, salary (yes, really), and whether or not you're eligible for rehire.