There are standards for various Internet-related functions. They are contained in RFC's: https://www.ietf.org/rfc.html
Headers "References:" and "In-Reply-To:" are well documented in the corresponding RFC describing e-mail message structure. (RFC 4021 and RFC 2822) See, e.g. https://tools.ietf.org/html/rfc4021#page-11
And the early description of how threads are formed can be found in this old document by D. J. Bernstein, -- the author of [one of] the first (and still actively used) program for transmission of e-mail messages between, "sendmail". That note is somewhat old (meaning that the standards may have been updated and extended since the time that was written), but it describes how threads are/should be formed.
Yes, I understood that there are standards, but if I understood Paris Geek's comment then those standards are simply not being followed by all apps/programs/platforms/web interfaces etc ... otherwise, if they were being followed, we wouldn't get this disconcerted issue of threads and conversation being displayed wrong or different or whatever. All I meant was that IMO it would be awesome if all platforms, clients, apps, web-interfaces, etc. followed the same standard so that we get threads and conversations displayed the same way and consistently throughout all the various platforms, clients, apps, web-interfaces that we use to view or emails.