You say you don't really know a lot of academia. I think what you need to learn about it for this situation is quite simple -- good academic practices are founded on good communication. It may be that the PhD candidate you are working with is not particularly good at it, which is even more of a reason for you to lead by example (of good communication) in this case.
As far as I understand, you have not yet discussed the possible paper resulting from this research with your PI. Take initiative in discussing this with your PI. Some advice for this discussion:
Come prepared with facts, not opinions.
So "I designed experiments X Y and Z and contributed to the analysis by performing A B and C" is good, but "I became very independent" is an opinion which you'd like your PI to reach based on the facts you present, and not something to say.
Especially if you're unsure about academic practices, phrase things as questions.
Conventions on author order differ from field to field -- a lot. But a practice that is/should be universally encouraged is discussing it before work on the paper has started. So after presenting your contributions to date, ask about the authorship conventions and discuss your place (and the meaning of your place) in that list.
Remember that the work is not done -- writing is a skill.
This is the key. While discussing the authorship, ask what should be your contributions going forward, related to the write-up. While it seems like you have done a substantial amount of work to date, maybe your PhD student co-author can make up for some of it in the writing phase.
Be open to the possibility that you are not correctly interpreting your contributions so far.
Being talked over is certainly not nice, as is somebody misrepresenting your work as theirs (in fact, that is called plagiarism, but that's a whole other discussion). But I still prefer to assume good intentions (while still being careful) from other people. This is why preparing for this meeting with facts about your specific contributions will help.
However, I don't know from your question whether this PhD student had separate meetings with the PI about the project. Did they contribute to conceptualising the research direction, or experiment design (maybe even before you joined?). So be prepared to listen and change your opinion about your relative contributions if new facts are presented.
Finally, there is a possibility that you take initiative, initiate good communication, however both your PI and your PhD co-author are not cooperating. Sadly, even if you deserve first authorship, while discussing it is certainly worth it, entering an argument over it isn't. Any undergrad publication is already a huge boost to your profile, regardless of where you are in the author list -- and if you can elaborate on your contributions when asked, that's how you can really shine. If any authorship is on the table rather than first authorship, and you do not believe the discussion went well (i.e. no facts were presented to convince you the other person was the primary contributor), take what you can get and look to move away from this PI in the future.