2-Segal objects and algebras in spans