Was there a better way to handle the situation?
Yes!
Especially that you've sat on both sides of the table, you are aware that an invitation to an interview means an applicant has already "shown a degree of promise" in the eyes of the company. It was up to the applicant to prise wider the opening of the door-that's-now-ajar.
Anecdote: 30 years ago I was one of several interviewed for an attractive position. Like you, the interviewer asked about my competence with a particular language and with a particular DBMS. The language could be assimilated quickly enough (another one, right?) and the DBMS would be a matter of adapting/extending to pick-up the particular dialect. The rest of the interview was very collegial, but I could not let go of the sting of having to admit that, at that moment, I had only shallow experience with what seemed to me to be critical skills. After the interview ended, I drove home thinking I'd never hear from them again. The following Monday, I was shaking hands while being introduced to my new colleagues. The interviewer and I are still good friends, 30 years later (although I had moved on from that position after only 18 months.)
Did Tom Hanks give up on "making fire" (in the movie "Outcast""Cast Away")?
Or, did he go back to try again and exploit the fortunate splitting of the bamboo?
Suggest you put on a brave face, frame the past in its best light, and try again.
"...and found a company I've always dreamed of working for."
You won't make your dreams your reality if you let them pass and add a "notch of regret" to your life's story.