Mathematics textbooks with history and/or motivation?
While studying analysis/calculus, I've found the following book to be quite interesting/motivating, even though I'm not so sure you can master the subject just by reading it alone:
Analysis by Its History, by Ernst Hairer and Gerhard Wanner.
My suggestion:
Journey through Genius: The Great Theorems of Mathematics by William Dunham.
This book contains within its pages the reason I became a Pure Mathematician. There is one chapter dedicated entirely to $\sum \frac{1}{k^2}=\frac{\pi^2}{6}$ and the ingenuity it took to figure that out. In high school our teacher tolds us the sum converged, but said it wasn't known to what. I found this book in my search for the answer and there it was, an entire chapter just on this one problem.
Every chapter is a gem of mathematics explained within the historical context of its discoverers and its times. I am not sure this is a book for a course, but if you need a reason to be excited or motivated about pure mathematics I strongly recommend it.
Willard's "General Topology" has an extensive section devoted to historical notes, providing a background to each topic he goes through.
Goldblatt's "Lectures on the Hyperreals" has a section on historical background in the first chapter.
Unfortunately there doesn't seem to be an English translation, but Jürgen Elstrodt's "Maß- und Integrationstheorie" provides plenty of historical motivation as well as several short biographies of key mathematicians detailing how they helped to develop the field.
Generally speaking, maths books tend to steer clear of history (and quite often any sort of context whatsoever). To compensate I tend to browse Wikipedia (and specialised wiki's like nlab when available) to get some sense of background and how what I'm learning fits into the bigger picture. It's not enough on its own, but it helps to supplement the more streamlined textbooks.
There's always Lawvere & Schanuel's "Conceptual Mathematics", which is an introduction to category theory aimed at undergraduates. It very much takes the approach of starting simple and motivating each next step.
To a lesser degree, Goldblatt's "Topoi" also attempts to motivate many of the ideas of topos theory, but he does so a bit more rapidly than the book above. This one is less for undergraduates, but is approachable with some determination. I can say I found the author's motivating comments helpful enough to make the material approachable at a time I had no more than a vague knowledge of set theory, so that's something.