The thing-in-itself isn't the same as theoretical entities, i.e. entities that we cannot directly perceive but can infer from our observation. Kant doesn't, unlike some empiricists, make a sharp distinction here. When he discusses the Third Analogy of Experience in the Critique of Pure Reason he says that, although we cannot directly perceive magnetic fields due to the particular nature of our senses, we can know it perceptually due to an immediate inference from the presence of movement of iron filings. Kant, in other words, would deny that there is any ground for skepticism about our knowledge of magnetic fields just because they cannot be, strictly speaking, directly perceived by us ("directly perceive" is my term, not Kant's - I hope it's intuitively intelligible what I mean).
You significantly underappreciate human ingenuity before "modern science" (let's say, XX-th century science). Atoms and other such entities were postulated long before Kant to explain various phenomena. And, yes, there were some who insisted that this practice is scientifically unsound (although I see no grounds for this) or (a view which is still common) that these are merely 'convenient fictions'. But Kant holds neither of these views.
The thing-in-itself doesn't have anything to do with empirical knowledge. It can be defined the object of knowledge of pure reason, entirely independently of affection by an object which is the cause of experience. And Kant denies such knowledge, metaphysical knowledge, but not scientific explanations which reference entities like atoms etc. which cannot be observed.
It must be said, however, that Kant himself wasn't a proponent of atomism.