This is exactly right: the emergence of socialism in the XIX century is not coincidental with the failure of Western religions to provide moral leadership during the accelerating industrial revolution. It is into this void that Marx and Engels stepped in. What we see now is merely a new stage in that process.
I referred to "Western religions" in plural because the same thing is happening in Reform Judaism in this country. The class view of society has replaced the relationship of an individual with G-d.