Thee are paintings in the 1700's showing upper class families with fitted carpets, so the fitted carpet came first.
Carpeting, obviously. The vacuum couldn't come until LONG after the discovery of electricity. We have proof of carpeting before that, but not with such high pile.