On the other hand, many companies don’t allow managers to give references.
What on earth do you mean? Who is going to stop me from talking to my manager?
Over my 20+ year career, in all-but one case my current manager has always been one of my referees and has known that I'm looking for other jobs.
Maybe this is a cultural thing. Here (Aus) references from colleagues are basically disregarded and all that prospective employers are interested in is referees from current and former managers.
There is no way I’m going to let my current job know that I’m looking for a job. That would be completely illegal advised.
If you think Australia is some utopia where the advice isn’t the same
https://www.seek.com.au/career-advice/article/should-you-tel...
https://www.sprintpeople.com.au/should-you-tell-your-boss-yo...
https://mane.com.au/news/how-your-boss-can-tell-you-are-look...
Maybe it depends how useful you are. IME, they're grateful to have you say a while longer.
One of the guys I work with had accepted another job and was virtually out the door when the new job fell through. My company gladly welcomed him back, kept giving him challenging work and eventually promoting him.
A couple of months ago I told my boss and my boss's boss I was going to start looking for other jobs. They tried to see if there was something that'd make me stay, and when there wasn't, they were 100% supportive. If I said tomorrow "actually, I've had a change of heart, I'd like to stay" they'd be genuinely pleased. This has basically been the story my whole career.
Sure, if your boss is an arsehole they'll do arsehole things. My advice is not to work for arseholes.