Per rest does work but issue is that needs to punish as without punishment it gives chance for someone to cheese game with it. Per encounter works if company truly put effort into each fight make it interesting and challenge in different way each fight. If not per encounter becomes set path do x,y and z each fight and win.
Per rest don't need know what's coming as you working tactically every fight only using what you feel needs to be used for each fight and therefore saving stuff for next possible encounter. Truth is makes you feel good if can complete whole dungeon without having go back to town replenish and makes you feel good when you meet boss and get use those powerful spells you been saving as not able use them every fight which made them rather fun (using most powerful spells should be limited and feel good when get use not boring cause this 100th time you used it and it means nothing to you any more.)
If you remove per rest and per encounter what system are you going use?
As for ambushing and the other things yeah we should have things like that and not just our party but the bad guys to. Fights need have lots things make it different and interesting.
Making resting and time progression an actual cost does certainly help (though that rarely happens, artificial restrictions like the camping supplies thing are just a cheap hack; the main cost there is that it's annoying to have to get more), but without actually adding tactical elements over a larger time span it's still not particularly compelling. It also only works in certain areas. Wandering around a city area for example there'd be no natural disincentive not to just unload your big guns on whatever, because there's probably an inn or camping supply store around the corner. Something similar applies out in the open, since probably you're not that far from resting options (often just one loading screen away) and travel time has no cost either. Conversely in dungeons and such you get the original problem of still lacking any predictive information, not knowing how deep that dungeon goes or what's in it. So how frequently you can rest without running out of resting supplies too soon is just a blind guess.
And sure, some people may feel satisfaction about using minimal resources, but if that's all there is to it you're essentially just forcing the player to make his own difficulty level. That's not good game design. I imagine I'm not the only one who on the one hand would want to actually make use all their cool goodies and spells and whatnot, cause they're cool and fun to use; but at the same time, doesn't want to accidentally overuse them and make the game too easy, because as it turns out the power level of those things was balanced against a less frequent use. This is a fundamental problem: if the cost of resting / time is at best vaguely defined, balancing anything that relies on that cost to keep it in check is essentially impossible to do properly. Which is why such per rest systems simply cannot be made to work (absent something like a DM). I don't want to have to save my resources on some vague promise that I might get to use them later on a big boss fight at the end (itself a fairly tired trope btw), I want to enjoy using all the various aspects of my character and party and items in the understanding that the game is balanced and designed around me doing just that; that the game organically rewards me for thinking ahead, for making clever use of what's available, for not being wasteful. And I'm not saying that is by any means an easy thing to do, but simple per rest systems certainly don't deliver on this.
Ultimately what I would want is to move away from artificial structures like per encounter and per rest, to a much more organic system. Where at least in some basic sense you can apply the same considerations as you would in reality, or some hypothetical version of reality. Wizards can only cast a fixed number of high level spells, why? We can imagine that it takes mental and physical effort to channel the energy needed to do so (and maybe it uses up specific (and scarce) additional resources as well). So instead of artificially restricting it two castings of a particular "spell level" (whatever that's supposed to represent), why not give them the ability to cast however much they want. Make them able to cast a spell with a little energy, with a lot of energy (or whatever); cast it quickly but maybe mangle it or miss, cast it carefully instead. And get exhausted as they do, which can affect them in all sorts of ways. As in reality, doing straining things repeatedly will wear you out; you lose strength, you lose accuracy, you lose focus, you make more mistakes; you might just drop unconscious from strain. And if you're backed into a corner, by all means try a last-ditch fireball at the limits of what you can do; maybe you'll just manage to save yourself, if the thing doesn't misfire and incinerate your arms.
Anyway, it's just an example. There's all sorts of ways in which games can be improved, that they give you much more of an impetus to be varied in your strategies, to change and adapt and force you to come up with new solutions on the fly. That at least is my ideal (and yes, not one easily accomplished). And I think an important part is moving away as much as possible from artificial structures like 'per encounter' and 'per rest' (but also 'spell level'); and also, to give game elements just more varied qualities (from the basics up, eg. weapons, shields, armour; now they at heart only have a small number of qualities (AR and action speed penalty, say), given them more and having everything have more strengths and weaknesses provides a far greater incentive to vary things, change gear and strategy).