Slimes, piglins, and ender dragons (list to be continued), do not respect the friendlyFire team option and deal contact damage regardless of their team.
To replicate:
/team add temp
/team join temp @s
/summon magma_cube
/team join temp @e[type=magma_cube]
Thank you for your report!
However, we are already tracking this issue, and this report is a Duplicate of MC-46956, which has been marked by the developers as "Works as Intended".
Please use the search function in the future to prevent duplicate reports.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki