Evolution of the electronic and excitonic properties in 2D Ruddlesden-Popper perovskites induced by bifunctional ligands