This was always the same thing that Unit tests were trying to bring, defend against your own errors and try to get the most quality out of the tools as possible. A lot of language progress has been exactly this over the years, from removing goto and introduction of for/if/while to constraining types and everything since. As an industry we could do with more of this mindset in general, just use everything we can to try and catch bugs earlier when they are cheaper to find and fix and avoid them happening at all.
I have always had a love/hate relationship with unit tests. I love them for all the obvious reasons. I hate them for all the times I read a test suite where 80% of the tests could have been eliminated by just improving the design of the system under test so that error condition wasn’t possible in the first place.