There may be too many replies to read this but I hope you do. I am writing this because I have years of practice at this and hope my learning can help.
From the start. People will send invites, they want to you to reply soon and to say if your child is attending. They do not want to hear any preferences, only serious food allergies or concerns. If you cannot get there on time, they prefer you do not go. If you cannot go, they do not want to hear or care why, but a brief indication of regret, something like "sorry, X will miss party as we are away that day, hope Y has a lovely party"
You should dress in your normal daytime clothes, I think yours were probably fine, there is no usual style. They do not want your child to come in fancy dress or very fragile clothes for practical reasons, unless it said on invite, but also that the party is focussed more on the child who's birthday it is.
They want an age appropriate card, usually before 8 or 9 years a gift is bought, go by watching others at parties, often after this age it changes to £10 in a card. The gift should not be clothes or too practical. A book intended for child could read could offend if perceived as too easy or too hard for the reader. So only picture /parent read books for youngest children. I find presents (when you don't know what a child has) as wasteful and pointless. Often I get craft things, as they may get used in time, lego or remote control cars. The present should be wrapped with birthday paper which is appropriate for age, gender and birthday or it can go in a bag.
I regularly ask my DH and best friend for feedback about my behaviour at social occasions and have done for the past 20 years. However I don't remember anyone ever giving unasked for feedback, especially such detailed and critical feedback as you have had and this is definitely rude and you should say this to them. If it was a while ago, probably too much time has passed.
I prepare 2 small talk things I can say. Usually questions for them. eg ask if their child enjoyed recent event/ do they like Halloween decorations in shops? I might say "I turned around in the local Spar and nearly jumped out of my skin when I saw the clown there" which is a mildly amusing/non controversial thing that happened and prepare it into a brief story. This sounds more arduous than it is, it is more easy the more you do it.
I wouldn't be concerned about leaving the room, this is fine, you can always look at your phone, it is no-ones business if you have to contact someone/want to check your phone, as long as it is for no more than about 15 mins.
If you are going to follow your child around closely I would say this to host at the start. It should be worded in a way that makes you sound helpful, not too serious and not make your child sound dangerous. ie "I'll just keep a close eye on her, sometimes she is a bit too friendly" "sometimes she gets a bit overwhelmed at parties so I will keep a close eye on her" "no matter how many times I tell her she hasn't totally got the hang of sharing yet, especially when she is in a new place, so I'll just stay near in case I need to remind her" etc this is a good way to avoid too much small talk also.
You should thank the host directly as you leave. Sorry if this sounds obvious. I often think "they are busy" or "they are talking to other people" they don't want a conversation but just lift your hand up, smile and say "thanks for having her" and depending on your daughter get her to say "thank you" also.
I don't care if people don't bring a present, wear fancy dress, wrap the gift in Christmas paper and spend the whole time sleeping in the corner. However if I do the above, it gives me a fighting chance of getting a superficial conversation in with other parents, which hopefully will help my children's socialisation (and mine) and stop us being completely invisible. I can then relax somewhat. Whereas if I had to push the social norm a bit, I would not be able to concentrate on my child and speaking to others.
I rarely show the inner workings of my brain. I hope this hasn't offended you.