C++/C#/Python absolutely do have ergonomic ways to do this (and have for decades by this point...) but programmers continue to use sentinel values. It is a bit puzzling.
First, you have the "our core libraries/dependencies were written when it was 'C with Classes' and we're going to keep using that style for consistency/laziness/because it's well-tested", and then you have the "C++ is ugly/full of segfaults/hard, I'm going to use <new language> which solves all these problems".
You have to pass those two filters before you get to people who are interested in writing good, modern C++.