Hamburger in the oven
As long as the hamburger is actually getting cooked through, you're safe.

But in a casserole-style bake, that may be a bit tricky, so you want to be certain that you're checking the temperature of it before you serve. You want the beef to reach the safe temperature of 160F. Think of something like a meatloaf... they're definitely cooked in the oven, not on the stovetop, but you need to reach a safe internal temperature or risk foodborn illness.

My guess is that most recipes call for cooking the meat first because when you brown the meat in a skillet, you'll develop some flavors in it through the process of the maillard reaction that give a more complex flavor. In baking the entire thing from raw, you will only achieve this browning on the surface of the casserole, whereas when you brown the meat first, you get it throughout.

Additionally, when you brown it first, you're able to cook off a lot of the moisture and grease (if you're using a high-fat percentage beef), which might otherwise make your tater tots soggy or very greasy. So, if you haven't, I'd recommend giving a version that uses browned meat a try first to see if you like the outcome.