Also switching lines like you did gives off he impression you are wanting to hold your position at any cost, which is like a red rag to a bull especially if they have punted you before.
Even if they hadn't punted you before, it lets them know that you're entirely unpredictable. If they have any intention of passing they're just gonna send it because you demonstrated to them that you're all over the place and the best they can do is try and get past you as quick as possible.
How should I have handled this? Let me know what you think.
Hold the inside line or back off and tuck in behind. A distant third is take the outside line, and way down the bottom is what actually happened.
To your credit, you know this and accepted it straight up. Good on you, that's a good attitude.

Stuff like this will happen and is a good opportunity for learning.
If you're on a straight and someone is catching you, pick a line early and hold it. You've made your decision (hopefully a good one), and by giving them time you give them a chance to make a good decision too. Only bad things happen by being unpredictable. If they pass you they pass you, if you're really faster than them you'll do it back to them next lap. If you can't get back past them, you'll be able to learn from following them what they're doing better than you.
You say you knew your opponent wouldn't care what happened to you as he passed, but we don't see any of that. I think it's likely he feels as aggrieved at you for previously cutting him off or moving aggressively as you do at him - and without specific evidence it's impossible to say who is correct. If anyone was even to blame at all - it's not uncommon in lower level racing (or higher level racing for that matter) for everyone to get mad about what was in hindsight a racing incident.
If you legitimately think someone is out to get you or is overly aggressive, the best move is often to just let them go. If they are actually aggressive, they'll probably wreck out at some point. The less you can be on the track near them when that happens, the more likely you are to finish the race ahead of them. You goal is to be ahead of people at the finish, and if that means that you spend 95% of the race behind them before they take themselves out then so be it. Play the percentages.
There also doesn't seem to be anything obviously wrong with his move from the limited information available. You ultimately went outside, and the move was pretty clearly on as he had enough of a run on you for you to bother weaving. He wasn't alongside you before braking (mostly because of the weaving), but there was a good chance he could get there in the braking zone so you had to assume he might be there when you turned in. You braked early and didn't hold the outside line, without contact I'd assume the two of you get through that corner two wide. There's a lot of banking on the corner to make it possible, although it's quite narrow and lag spikes make it pretty risky.
You should be ready in a situation like that for people to make that move. It's hard to tell without their perspective or an outside cam, but I think most people at least think about having a go on you there. It might not technically be the smartest place to try and overtake, but it's reasonably legit.
It's also a corner worth considering whether you want to fight them there. It's tight and with other cars behind you're pretty much guaranteed to get punted even if you just get sideways and scrub a bit of speed. A crash there is going to be major. Letting someone go, following them over the mountain and getting them again down Conrod and into The Chase is probably a smart move, and if you do that every lap you're always going to be in front at the finish line.
If you don't do this already, it's worth sitting down for a few minutes before a race and planning where you do and don't want to pass and fight people for position. Tracks with big straights like Bathurst are good candidates for strategically letting people go - if they want to be ahead through the twisties then whatever, it just means you can draft them on the straights.
P.S. Assists are fine. Whatever you need to keep the car under control consistently is the most important. People get narky about assists, but unless you're pushing to be a top split racer then whatever helps
you be as safe and fast as you can is best.
As the saying goes,
Safe is Fast. Most of the stuff on that site applies to sim racing as much as RL racing. Lots of great advice from successful real life racers.