Yes, something like SecureBoot possibly could be a piece of a system that guarantees the operation of code - though, it need not be either (e.g. the hardware could come with a formal proof or model, and a checker could verify the loaded code follows the proof - not caring where it comes from).
However, SecureBoot is not that system, nor does SecureBoot of itself get you any closer to that system.
E.g. how many systems get their boot path compromised, without the exploitation of any software bugs? That's basically never the case with malware. If you can compromise a system, you can find a way to have some apparently innocuous data file exploit a bug in some code that interprets it to inject code (JPEG parsers, Flash, JavaScript, etc.. take your pick, the list is endless - they're all buggy, cause we don't know how to write bug-free code), and then take-over the machine - that will work for the initial exploit and it will work to re-exploit the machine after reboots. SecureBoot just doesn't do anything to stop this, and these are scenarios which exploits already regularly use.
SecureBoot doesn't stop the bad guys. It will only stop the less-technical, more ordinary users from using their computers the way they want.