What's the history of golf holes and golf hole liners?

So, I know that an early form of what we know as golf consisted of hitting pebbles with crooks into rabbit holes. Nowadays, perfectly-machined 4 1/4" holes are made into manicured greens, with a liner to hold the flagstick and presumably keep the hole’s shape.

How did we get to this point? When was it decided that a liner for the hole was needed, and that the hole had to be 4 1/4" in diameter?