The thing that does out of scope is one pointer to the memory, not the memory itself (it doesn't have a scope, just a life time). You wouldn't want to free memory whenever any pointer to it dies - virtually always you want to hand out temporary pointers (e.g. pass them to other functions), return a pointer from a function, store a copy of the pointer in some other places, etc.
In other words, in the course of using dynamically allocated memory you'd necessarily create and destroy many, many pointers to that memory. You wouldn't want most of those pointers to take the memory with them, only the last pointer should be used to free the memory. Any earlier and you get dangling pointers; any later and you don't have a pointer any more and can't free it at all.
There are ways to couple memory mangement to the life of a pointer, including the ability to transfer ownership: Returning the pointer, moving it from one variable to another, etc. This is a so-called smart pointers, specifically unique_ptr
.
However, this is not suitable as the only pointer type, you still need non-owning pointers for all the aforementioned uses (handing out temporary referenced without freeing the memory afterwards). In addition, this idea (or at least its adoption into the mainstream) predates C++, as far as I know. It definitely predates C, which means C++ would need to keep raw pointers even if Bjarne had been born with innate mastership of smart pointers.