Collisional formation of top-shaped asteroids and implications for the origins of Ryugu and Bennu