Cows, Sheep, Pigs, Chickens and Rabbits (and probably other mobs too) are able to see a nearby player through blocks (opaque and transparent), if that player is holding the food the mob likes.
All mentioned mobs were able to detect the food through blocks. Other mobs aren't affected by this bug. Untamed Wolves for example won't react to a player holding a bone or food behind a wall.
I did not test this bug with all breedable mobs
Thank you for your report!
We're tracking this issue in MC-159647, so this ticket is being resolved and linked as a duplicate.
That ticket has already been resolved as working as intended, which means this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki