This happened to my sister about a week ago, and I logged in just now, and am now also having this issue. I'm on Xbox One, but the thread for that was marked duplicate, and directed me here.
I'm having this issue as well, as you can see from my picture, all my animals are doing it, though mostly the pigs, sheep, and cows. The chickens do also do it some too though. I also have animals gravitating to doors around my house/barn areas, horses wanting to stick to their barn doors.
This is still happening, been playing about 10 days now, and mobs spawn outdoors regardless of the amount of torches, even if their only a couple blocks apart. I also get bats in my house (no mobs though thank goodness), even though I'm at sea level, and have only a 7 block high house that is very well lit.
I've not noticed it it 1.17.1 so far. But it's definitely happening to me in 1.16.5. I dug around everywhere I could think of and have yet to find anything, but one cave that was way to deep to be within 8 blocks, I lit it up anyway. Still can't sleep in the bed due to monsters nearby.