I think I got it. Made a test site. With permalink structure:
Published a post. Then changed permalinks to postID/post-name. Tested with looking at network stats from the browser. Here's what I got, a 301 redirect, after trying example.com/2018/11/04/hello-world/ from my browser:
I tested another thing. Using different permalink structures, I tried to make two posts with the same post-name (the link part where post-name is). WordPress won't allow it.
My conclusion is that post-name and postID are both unique. This would explain why this auto-301 redirect works, as well as why having a flat directory structure of example.com/post-name isn't so slow performing, as it was before WordPress 3.3. (I think) version.
Another interesting thing is that, using permalink structure of postID/post-name, I can enter in a browser: example.com/postID (with or without trailing slash) and the browser goes to example.com/postID/ (with a trailing slash) directly, showing the contents of example.com/postID/post-name.
So this seems to be nicely sorted out, no need to worry about manually setting 301 redirects, either with .htaccess entries (my planned change would have required manual redirect for each post, since I'm adding a unique ID in the link structure). No need for plugins as well.
What needs to be done is change all the internal links - WordPress doesn't automatically change them. It does 301 redirects, but the old links remain. That's a bother.
EDIT: after a month on a live site, wrote in detail about results, how the redirect is made, how I tested:
WordPress permalink change