Magnetic and f-electron effects in LaNiO2 and NdNiO2 nickelates with cuprate-like $$3{d}_{{x}^{2}-{y}^{2}}$$ band