Software code DOES get subpoenaed all the time in disputes. This doesn't even have to be criminal cases, in civil cases as well. If the code resides in a version control system of some sort they typically get all of that as well. (Some smart guys have tried to deliver code in printed form to bury the other party but the courts have mostly refused those 'smart' tactics.
Email gets subpoenaed all the time as well. Again bot in civil and criminal cases. Also from outside vendors. This is not a big issue. A company gets a subpoena from a judge and they hand over the data. What is troubling with surveillance in the US is that it is happening on a massive scale without judicial oversight.
Your latest paragraph is moot. Once served with a subpoena those materials HAVE to be turned over. It doesn't matter where the data resides. If people can see it and manipulate it it can be turned over.