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.
By definition, we know of zero examples of geniuses who were never discovered due to poverty, which makes it hard to extrapolate the rate at which this happens. But we do have examples of geniuses who grew up poor but were discovered nonetheless, which gives us hope that exceptional people in similar situations will be discovered. Especially today with global primary school enrollment rates close to 90% [1], and secondary school rates around 76%.