Only modern people without understanding of ancient context could take it as an opening sentence of a funerary dirge or pietistic outpouring of faith. Everyone in the Ancient Near East was well educated in what I would call a "bucolic demagoguery".
Images, metaphors and vocabulary of shepherding were as old as first domesticated animals and always contained strong overtones of power and domination. The excesses of power were only mildly controlled by pointing to the self-interest of shepherds to keep a healthy flock.
- In Sumerian epic, when Gilgamesh (a legendary Sumerian hero) behaves like a tyrant, he is reminded by his subjects, he should act like a shepherd. Gudea of Lagash (3rd millennium) is called “shepherd who leads the people with a good and steady hand.” Lipit-Ishtar (early 2nd millennium) is called “humble shepherd of Nippur.” Hammurabi of Babylon called himself a “shepherd appointed by Enlil”. Many Neo-Assyrian kings liked to portrait themselves as shepherds. In Egypt from Middle kingdom on, kings were called “herdsmen of all men” Amenhotep III is called “The good shepherd, protecting all people” Seti I “the good shepherd, who keeps his soldiers alive.” Merneptah calls himself “ruler, who shepherds you”. In Homer Agamemnon is called “shepherd of the host.”
If the psalmist sings “The LORD is my shepherd” he makes a powerful theocratic statement which contained strong anti-imperial and anti-monarchic edge.
Many biblical parables and metaphors of shepherds (Cf. Ezechiel 34) criticize rulers for their abuse of power and lack of care for their subjects. Similarly, the synoptical parable of the lost sheep is an implicit political criticism of those, who allowed it to happen, and it contrasts the realm of God with the contemporary political arrangements.
And when Jesus of the gospel of John says “I am the good shepherd” we hear Johanine community making a very powerful theocratic ideological statement.
The one who criticized neglectful shepherds of his day and sought hope in theocracy (kingdom of God), is here declared the Shepherd, ergo the King (ergo God).
Jesus himself (the historical person) might be quite surprised! (But that would be another chapter.)