Spin chain on a metallic surface: Dissipation-induced order versus Kondo entanglement