Jammyhand
Genuine feedback: I'm someone who appreciates direct honesty, but the message comes off as very passive aggressive, not honest or direct at all.
@All2Well did say "You run the risk of them just dumping their child on you whenever they feel like it, you need to be honest but nice." So I do think the message was intended to have passive aggressive elements ("please don't send your child round like that again" – only it doesn't actually say that and just beats around the bush in an accusatory way).
"Will have a chat with her later and explain she needs to ask me first as we might not have been in and I'd hate either of them to be disappointed" – why would she need/want to know what you're chatting with DD about and why? Why should she care about what your DD gets up to, and what your home set up is – unless it involves her somehow? It sounds like you're indirectly telling the mother about the potential inconvenience her own child's presence could have caused, by claiming you would talk to DD about that.
Essentially there's no direct request / conclusion to do with the recipient parent (e.g. for the parent to check with OP in future) in the message. It's just a long random ramble about why OP's DD shouldn't randomly invite others home, and how it's lucky that OP could take the child in today ("luckily our plans today can be flexible"). The message is "be guilty and grateful".
UNLESS you have a request for her like "please check with me in future", then the background / reason (about the inconvenience) is important. But just directly and nicely tell her that it might be inconvenient as you might not be home. Don't tell her that under the indirect guise of "I've had a chat with my DD about the inconvenience".
Also, I think it's arguably fine to honestly say you weren't expecting her child, but you can do that without talking about why DD shouldn't invite random children home in the long term etc. If you go on about how DD's actions were a mistake in such a long message in such a faux tinkly laugh manner, it makes the reader wonder what point you're trying to make about their child's presence in your home.
For those who were asking, this is exactly why the text suggested much earlier isn't simply factual, and would actually be pretty offensive to most people on the receiving end.
FWIW I've been amazed to learn that there's something wrong with 9 year old children inviting friends round without making arrangements in advance through parents. Things have clearly changed enormously since I was a child!
And I'm also pretty amazed to find that some people don't know that some other people call the midday meal dinner, and would need to have that explained to them.
What a weird thread!