It does, governments can pass laws, big businesses can't. They may buy politicians to pass the laws for them but in the end they can't pass the laws themselves.
Then lets not ignore the fact that most countries had to make laws specifically to protect working parents. There are most likely entire warehouses filled with court cases over a business owner realizing that statistically hiring a non married replacement for the recently married employee will be better.
They wont do it out of racism, they wont do it out of religious fervor. However they will do whatever they can to make more money.