I don't have data for actual ranks around the turn of the century, but I do have information on the underlying reason: "supply and demand," specifically the latter.
U.S army strength peaked at over 1 million men in 1865 (Union) for obvious reasons, and fell sharply to less than 40,000 by 1869.
General Pershing was born in 1860, and joined the Army in 1886 at age 26 when U.S. army strength was at its low point. The Spanish-American war brought about a lasting boost of U.S. strength from 27,000 to 80,000-100,000, roughly a tripling. It also brought about a long delayed promotion to Captain. And "the rest is history."
General Patton was born in 1885, would joined the Army in 1909 (aged 24), and was involved in World War I eight years later, at just about the "right" time frame to be promoted to Captain. "Demand" ensured that he would.
One other thing. I forget where I read this, but the average age of an American Captain is in the late 20s, and the average age of a British Captain is in the early 40s. Pershing was promoted in line with the British schedule. Patton was promoted (almost) in line with the current American schedule, which basically began with World War I.