It’s not entirely useless from C++. It’s definitely unfortunate that it doesn’t produce a compiler error in those cases but it’s a surprisingly difficult issue to solve completely. In fact it’s possible to pass in the wrong type of class from blueprint as well without trying too hard.
But what you do get in C++ is that even if the wrong class is passed in, TSubclassOf::Get will return nullptr if the assigned class is wrong. So you can catch it at runtime and check/ensure/log.