3rd party AV softwares are notorious for not completely uninstalling. Uninstalling through regular Windows uninstall methods is not enough. It is for this reason one should use an uninstaller like Revo that scans for leftover files and registry entries (to be used for ALL uninstalls not just for AV).
Free fully functional download of Revo Uninstaller Pro, Pro Portable and Revo Uninstaller Freeware. Quick and fast download here.
www.revouninstaller.com
When an AV is installed it "registers" itself with Windows Security Center which, in turn, turns off real time Defender. If an AV does not cleanly uninstall, certain registry entries it leaves behind make Defender think it's still installed.
As far as I could find Avira does not provide an uninstaller for Windows to clean residual files/entries.
You can attempt to reset WIndows Security. It's doubtful it will work in this case but stranger things have happened.
Reset Windows Security app in Windows 11 Tutorial
You can try reinstalling Avira, and then use Revo to uninstall it. Choose the advanced scan in Revo and check every entry it finds leftover and delete
OR you can do a system restore to a point before you uninstalled Avira. Then use Revo to uninstall it.
Restart. If Defender still will not turn on, you can attempt to manually resolve leftover folder and registry entries, (Folders in Programdata, Program Files, User appdata) Search the registry but be careful when working there. Always, always backup the registry first.
If these suggestions don't work for you, backup your data, buckle up, and do a clean install of Windows. In a case like this, IMO a repair install will not resolve the issue.