The code I write is going to be used for 20-30 years, and then when the platform is replaced I assume someone will read the code to see what they have to do to get the system working on the new platform. I have documentation for end-users and documentation for maintenance / troubleshooters and zoomed out documentation that explains the problems and approaches taken, and sometimes justifying any tradeoffs.
If code is temporary then it might not be worth the effort to document, but my documentation is what everybody except one person 20 years from now sees along with the user interface, so for my application the code doesn’t matter and the documentation matters quite a bit!