Colin, this is a great topic.
In Chicago, there were two courses in the infield of horse tracks.
1. The original Washington Park (near the park of the same name in Chicago) course opened in 1896 and closed when betting on horse racing was banned in Illinois in 1905. Charles Blair Macdonald and Richard Leslie shaped the nine holes. Only the first tee and ninth green was outside the oval.
2. The Harlem Jockey Club course, in Oak Park on Roosevelt Road, just west of Harlem Avenue, was a nine-holer that opened in 1901. Birthed by club landscaper John Thorpe, he brought in James and David Foulis to design it in the fall of 1900. At 2,524 yards long with a bogey of 39, it was used through 1904 by members of the HJC, then two other clubs.
2A. In 1910, the Harlem course was reworked by David McIntosh and reopened inside the now-dormant oval. By 1913, it was expanded to 18 holes and was one of the few privately-owned public courses in the Chicago area. The last season of play was 1941, with the Navy buying the site to build a torpedo plant in early 1942, about six weeks after Pearl Harbor.
But wait, there's more. There was also a Chicago-area course inside an auto-racing track. On July 4, 1916, Speedway Park Golf Course opened nine holes designed by Tom Bendelow inside the two-mile Chicago Speedway Park oval in Broadview, a high-banked board track made of 2-by-4s (the way to build a high-speed high-banked oval for what we today call Indy cars at the time). It was a few miles from Harlem. Another nine was to open in 1917. By 1918, the track was bankrupt and Edward Hines, who had sold the place the lumber, bought it for that lumber to build a hospital for wounded servicemen on the site. The modern Hines Hospital stands there today. (It wasn't until 1929 that the Indianapolis Motor Speedway opened its first course in the infield of the Brickyard.)
Outside Chicago, don't forget Torrey Pines, the 36-hole complex built on the bluff that from 1951 through 1956 was the scene of one of the most important sports car races in the U.S., held on a 2.7 mile course on the old Army base. It only closed because San Diego's municipal board fancied using the site for golf.