It’s been a while but I seem to remember that the first book of Landau-Lifschitz‘ Theroretical Mechanics starts with a 20 page discussion that does this and culminates in the Lagrangian.
I recently got hold of a copy of that. I started Hand & Finch - Analytical Mechanics but their woolly discussion of virtual work and virtual displacement was very frustrating and unenlightening. Perhaps I'll have a better time with L&L.
It's a great introduction to Lagrangian mechanics, but as I recall (it's also been a while for me), the motivation for extremising the action is also somewhat vaguely presented.