Yosemite is the one place that it is absolutely worth trying very hard to get a site in the valley. The park is the absolute gem of the NPS system and there is nothing else close to it.
There are a couple of CG right outside the valley that are second best but still excellent and they may be a little easier to book.
Anything outside the valley is much less desirable since it means a long drive in and out each day.
Yellowstone is the other major park that you want to stay in the park, even more so than Yosemite since the drive is even longer. Glacier and Rocky Mountains work fine with a CG right outside the park.
We prefer staying inside parks when practical but free form traveling doesn't make that easy. I'm used to Florida State Parks which are difficult to get reservations in any time of the year but Oregon and Washington State Parks may be easier. We never even thought of checking.
We use the same style of traveling tho, find a place to camp and then use that as the base camp to explore the area. Then move on.