People play rock music with all sorts of different basses. Each has its own sound and character, but "rock" means a lot of different things.
Yamaha is a good company. The RBX170 is their basic, low-budget model. But that will be true of just about anything in your budget.
Do you have $200-300 for the bass and other money for an amplifier, or is that all that you have to spend? If you're in the US, you can get a decent cheap SX bass from www.rondomusic.com
for $100 plus shipping. That will leave you money for an amplifier. If you can spend $300 on just a bass, I would look at the Vintage Modified basses from Squier, or a better Yamaha (like the RBX374).
Yes, you can teach yourself. I did. Lots of famous bassists did. But it takes more dedication and self-discipline to figure out what you need to learn and to do it. If you have a teacher, they can tell you what to work on and then expect to see the results next week. Without one, you have to put that expectation on yourself. A teacher is better, but if you can't afford it, you can't afford it.