No, they probably didn't earn billions from that code. Their biggest cash cows were feature phones (non-Symbian) that sold 10-50 times as many as Symbian phones and were developed with many times smaller budgets. While some Symbian phones were pretty good for their area, there were probably at least as many failed projects as successful ones.
I don't have any data to back this up, but I think they sold hundreds of millions of high end (and expensive for the time) smartphones running Symbian. Remember the N line? The E line? Communicators? All running Symbian, all bestsellers for years.
No, I remember attending parties when 1 or 2 millions of a model had been sold. At the same time Nokia sold over 100 million of feature phones a year.
Edit:
As you write they were expensive. So while Nokia was the undisputd leader in the segment for a couple of years the absolute numbers were not that big. I remember some year the worldwide phone market was 400 million a year. Nokia had over 100 million of them, but smart phones (Symbian) only single digit millions.
One model, N95, sold 10 million units. It was priced at around $500. That's 5 billion revenue from one model alone. I'm sure feature phones sold a lot more, but that's irrelevant.
Yes, 10 millions for the N95 sound possible to me. But that was after 10 years of development with many 1000 developers. Revenue is not earnings. The orginal claim was that they earned billions.