I just got the solution for this.
I did a research on this and found that the reason for the error being thrown is the order in which elements are provisioned through the definition in onet. SharePoint provisions in the following order:
2)SPSite scoped features defined in onet.xml, in the order they are defined in the file.
3)SPSite scoped stapled features, in quasi random order
4)SPWeb scoped features defined in onet.xml, in the order they are defined in the file.
5)SPWeb scoped stapled features, in quasi random order
6)List instances defined in onet.xml
7)Modules defined in onet.xml
Reference : http://blogs.msdn.com/b/mcsnoiwb/archive/2008/05/28/site-provisioning-order.aspx
And since lists are created only after the Site and Web scoped features are provisioned, my feature code does not get the list it is searching for and hence throws the exception.
A work around to this solution that I have found out is -
First create a feature which will provision all your lists and through list instances.
Then activate the feature that is looking for the list (the feature which is throwing the error.)
I have tried this and it is working fine.
Another suggested work around that was found is creating the site definition using the SPWebProvisioningProvider class.
Please refer the link below -