This answer only examines the use of carpeting as a built-in residential floor covering in the United States.
The most common type of floor covering in most residences and offices in the United States today are machine-woven tufted carpets, nearly universally made with synthetic fibers like polyester and acrylic. "Tufted" means that the carpet is made by injecting the pile into a backing material, which is then secured in place via glues or other adhensives to a secondary backing material, rather than being woven or knotted to a single layer of backing, which the pile surrounds. Tufted carpets were invented in the early 20th century, but did not become popular as a immovable flooring material until the late 1950s. There are, in my humble opinion, three main reasons for this:
Early tufted carpets were too expensive to cover a whole house with, and also were made out of wool, which made them harder to clean, more apt to be damaged by pests, and available in fewer colors. In the 1930s, tufted carpet manufacture was mechanized, which lowered the price enought that they began to replace wool carpets for use as area rugs, especially in the rug lacked a complex pattern. Then in the early 1950s the development of cheap colorfast synthetic fabric dropped the price even further.
Carpeting an entire house with immovable carpets was impractical before the invention of the electric vacuum cleaner. Otherwise the housewife (or her maids) would be spending a great deal of time and energy trying to beat the dirt out of the carpeting. And beating a rug generally requires removing it from the floor regularly.
Carpets had previously been seen as a luxury floor item, so when they finally got cheap enough to use in middle-class and working-class housing, people went a little nuts. You see popular tastes in this matter start to shift in the 1990s, but right up into the 1980s people are putting deep pile carpets everywhere into homes, especially for suburban tract housing.
For more reading about the history of the carpet industry in the United States, Randall Patton wrote an article on the subject for the Economic History Association: https://eh.net/encyclopedia/a-history-of-the-u-s-carpet-industry/
For more reading on the history of carpets as a fashion in interior design, I suggest Gura and Piles' authoritative (and dreadfully boring) History of Interior Design.