Learning Rust is probably onone of the more accessible ways to get this kind of experience. It won't teach you everything you'd need to know to write C++ professionally, but it teaches a lot of the it, including a lot of best practices that it's otherwise hard to learn outside of a professional environment.
I don't know, someone who solves their borrow checker errors by adding more dynamic allocations (which seems to be common/recommended), will be taught how to program in Java, not C++.