Yes you could but it would be better if you sauted the onions first and then added it to the rice and baked it. but i think that a recipe for rice pilaf ill work best for you. you can substitute water if you dont have stock for this recipe and instead of letting it cook on the stove you can put in the oven at about 350 for about 15 or 20 min or until you tip it and see no liquid.
http://elise.com/recipes/archives/001825rice_pilaf.php