Hello fellow introvert. I too have struggled with these dynamics in the past.
Im introverted and have always enjoyed my solitude. Some people have complained that I don’t talk much, which is true, I don’t need to talk to feel good.
but jesus christ, others outright avoid even eye contact with me like the plague, even though I kept greeting them for at least 2 more days.
Sounds like you've met people similar to you. How would you prefer others handle you? I'm guessing it's "ditch the small chat, and get to the point". I'd say, treat these people like that. Focus all your conversations with them purely on the shared work and leave them alone otherwise.
I confess neither do I know how to react when people are friendly when I’m talking to a coworker they like but the moment this coworker leaves, they turn to a mute.
It's likely that they have an established working relationship with the other person but not you and so they freeze up in a 1:1 scenario. Just continue to engage with them in group settings until you establish rapport.
It’s also a bit funny: 2 coworkers that the first day had small but normal conversations with me now look elsewhere when they see me… and I give them back the same treatment. Childish and petty? extremely, but I ask you: what should I do?
You don't have to do much. Continue to be friendly with them and if they don't reciprocate just engage with them on the work alone. If you need something from them, ditch the small talk, explain the problem clearly and explain what you need from them.
I think you're trying to take a one size fits all approach here. You need to adapt to each individual. For those who want to be friendly and chatty, hit them up and engage with them. Find them to be boring? You pretend to care, ask them a few follow-up questions (people love to talk about their interests) and then glance at your watch and say "ugh, I'm really sorry to interrupt, I've got to //".