At the time, they really wanted to pivot from a computer company to a device company after the success they found with iPod. Remember at first they didn't even want to allow 3rd-party apps: that's how device-oriented they were thinking.
The computer landscape in 2007 punted the problem of viruses and inability back on the user. I think Apple's goals when they finally did an app store were to (1) ensure iOs-specific native software (vs crappy ports), (2) prevent viruses and malware, and (3) keep the phone as stable as possible.
I think you could argue that there were other ways to approach those goals, but I think it's harder to argue that preventing side-loading was entirely pointless.