Yes, onions will cook in the sauce as well but they take MUCH longer to do it this way and you run the risk of having partially cooked onions in your sauce. By cooking them first in the pot releases sugars and makes them taste sweeter versus having a strong onion flavor throughout.