I do not believe that for one second. As someone who has interviewed hundreds of candidates, there are many things a prospective employer really, really does not want to know. Religion, sexual orientation, veteran status, the list goes on... A company that finds out these things and rejects a candidate for any reason, even a legitimate technical one, is begging to be sued.
The laws about these things are there because at least some employers do want to find out these things. Some of those employers would love a more innocent-sounding way of finding out those details exactly to reduce the chance that the candidate will think they have grounds to sue.
That is what LinkedIn is for...