They might try it. But rats and mice have pretty sensitive eyes and noses. So they would likely not like them much raw. I have pet rats{our girls more exactly} that will eat them cooked in tater tots.
I dry my onions in an old outbuilding with a dirt floor, and leave them there for a couple of months. The building is home to plenty of field mice. I’ve never had them chewed on.
Kansas packrats love the bulbs of walking onions. They regularly store them as winter food. They not only eat them , they are one of their favorites. I have seen voles specifically avoid garlic it is repulsive to them. Their tunnels take a detour to go around garlic. Voles love sweet potato, potato, peanuts, and other root crops. Depending on the rodents you have will determine your level of problems. You are not safe from Packrats in my experience , but all other rodents will avoid you like the plague most likely. By the way storing garlic with them would help. Packrats will not gather garlic in my experience like other rodents they find it repulsive. Your results may be variable see below.