If you think about it - it is the same: how do you know the system you just built is flawless?
You have to use ad-hoc methods but then it is not possible to know your ad-hoc method is correct!
So by "flawless" you can only mean "having some property but we cannot say what property it is".
Edit: added "flawless" definition
This procedure (algorithm) is ill-defined (is not realisable by a TM) as it would require verifying two things:
a) the code you are about to write has a bug (ie. has a specific property)
b) the code you wrote does not have a bug (ie. has a specific property)
Rice's theorem says both are impossible.
So, to go back to the original point, you can't reliably determine the correctness of every possible program. But you could, if you were not prone to error like all humans, always write your own programs such that they are always correct.
From the fact that we know how to write programs that halt you cannot deduce we know how to write programs with arbitrary (or even just useful) property, because there is no general procedure to do that.
In other words: you cannot use the algorithm of writing programs that halt to write programs computing nth digit of Pi :)
Perhaps you interpreted my post to suggest that you could build a machine that verifies that any arbitrary software run on it never enters an invalid state? If so, I agree, that is not possible. I made a minor edit to make it clear what I’m talking about.