He did also go to school and even tried to go to college, he even got a scholarship! He had a lot of issues with the non math coursework however and did not finish any degree that I am aware of.
The reality of his life is a bit more complex than "oh a poor boy found a basic math text book and taught himself to be one of the greatest mathematicians in history"
What is more interesting here is to imagine if he grew up with wealth and formal training, would he have died at 32? Would he been given the time and resources to actually become one of the greatest math geniuses out there?
Ramanujan had a lot of raw talent, but it wasn't honed, and ultimately it was cut extremely short and wasted.