My answer here is intended only as an addition to the insightful answer already given by @Allure.
During the course of my own PhD, I worked with a colleague (here called Q for convenience) of my supervisor. I had collected a large body of empirical results concerning a particular perceptual phenomenon. Q is/was exceptionally experienced at the development of mathematical models to describe perceptual phenomena. I worked together with Q, largely as a provider of the empirical data for, and verifier of, the model. The model was ultimately discussed in one of the chapters of my thesis, and presented in detail in an appendix.
Critically, at the beginning of the thesis, where the declaration of originality was required by my university, I explained that the model was essentially developed by Q with some contributions from me. The model forms a very useful part of the thesis ... but the thesis itself was substantially more than the model. Moreover, just as with the thesis, the model formed a part of a larger peer-reviewed publication on which Q and my supervisor argued (as @Allure commented!) that I should be first author.
As @Allure also remarks, no matter the problem your supervisor is working on, and might solve, it almost certainly a subset of a larger problem, just as the model development represented only one part of the research in which I was engaged. There are likely to be many more reasons to be delighted than to be despondent.