This is a prospective cohort study - it is not meant to cover all limitations. Every scientific study will have strength and weaknesses, an RCT won't ever have 350 000 participants. Studies with large sample sizes almost always have to resort to either self reporting or interviews in order to collect at least some of the data.
You're not meant to take an individual study's results as the truth - it's the overall body of research that's important. When you see the same or very similar results from studies with varying study designs from different populations done by different researchers with different methods the results become more credible.
Though this specific study is notable as the effect size is quite large, the bias from self reported coffee or tea intake would have to be quite large itself to remove it.
And with regards to coffee and tea consumption and research, this is a pretty well researched area already, and the general consenus is that consuming tea or coffee does have health benefits.