How will taking upper level undergraduate courses online affect graduate admissions?
Given your terminology (you wrote "research university"), I'm going to assume you're in the US.

This is a bad idea.  Admissions committees will have no idea how to evaluate the online classes, and will probably not put very much weight on them.  As @ff524 notes in his comment, you will not have any good letters of recommendation, which are essential for an application which is a bit outside the norm. You are incredibly unlikely to get a spot in a graduate program that is likely to result in a becoming a professor at a research university if you depend on online classes instead.

So, what should you do instead?  Well, first reconsider if being a math professor is what you want.  You're absolutely right that there's a real risk of it not working out, and a lot of competition.  But if by trying to keep your options open, you do less to make yourself a qualified candidate (both on paper, and in actual point of fact), then you're just putting yourself at a disadvantage, and making your chances that much worse.   You will be in very bad shape if you don't get a BA which includes a math major, and take a lot of advanced math courses (more than the bare minimum required for a math major!) in person with faculty at a well-respected research university.  Note, that doesn't necessarily preclude getting another major.  

On the other hand, there is good news.  The people who get BAs in math, or start mathematics grad school and don't finish, or who finish but don't get an academic job (or one they want) do find other things to do.  If you have complementary skills in computer programming, then you will be very well set up to do a lot of things.  I don't suggest starting a math PhD as preparation for a job at Google, but I do know several math PhD's who do have such jobs.  So, if getting a BA in math and then perhaps a PhD in math feels like what you want to be doing in the moment, then I think you can reasonably do it, and figure you will find a job if the academia thing doesn't work out.