NotesApp in iPhone 6s Plus w/ iOS 10.2.1
It has to do with the storage format "sqlite" that is used by Notes.app. Sqlite is a very common storage format used by very many apps, and also for programs on desktop computers, in embedded systems, etc.

The "sqlite" format makes it possible to structure data to enable fast searching, updating, etc. However, it is organized in such a way that when an application delete data, it is actually not "erased" as such on disk. Instead smaller blocks of data are marked as non-used. When the user adds new data these smaller blocks are reused in order to improve performance and ensure that the on-disk file does not grow unlimited.

This is why you can see parts of deleted notes inside the file, and also why you can see parts of differents notes "cross each other" in the file. The file is simply not read by the app in a linear fashion (i.e. from start to end), but instead in terms of blocks in various patterns accounting for the various writes and deletes that happened to the file over time.