The way mobs spawn on realms seems to rely more on the openness of the landscape rather than the light level. I have a realm that was started a few months ago, and I have built several mob farms which have not worked. I have seen on Reddit and a few other places people reporting this, and it seems to have to do with a 10 chunk limitation in the settings of the realm.
Related issues
Comments

Thank you for your report!
We're actually already tracking this issue under MCPE-21856 so I've requested this report be resolved and linked as a duplicate. The mob spawn rules for realms are the same as for single-player, but with more players you are likely to reach the mob caps sooner.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
Please don't forget to use the search feature before submitting a bug to see if it has already been reported. The less time we spend linking duplicates means more time testing and confirming the bugs.
Quick Links:
📓 Issue Guidelines – 💬 Community Support Discord – 📧 Mojang Customer Support – 📖 Game Wiki