It is conclusively trivial to automate the iMessage client using accessibility APIs and in fact this has been done many times before to great effect by numerous developers to implement everything from auto responders to bridges for iMessage from other systems... including by Beeper for prior versions of their product!
And like, hell: you mention "social media platforms", but they also have been known to put in lots of effort at times to break alternative clients... Meta, in particular, sometimes goes to lengths sufficiently annoying that a ton of real users using browser extensions on Instagram/Facebook get caught in the cross-fire.
If you want to send spam over iMessage, the thing preventing that is categorically--and, frankly, obviously to anyone who is willing to question Apple's PR spin--not (and never was) the inability to use it from a device running Android or anything about the inscrutability of its protocol being documented and re-implemented by others.