That must be Germany-specific because I don't think that's universal. As far as I know, anything I write in my free time is mine, unless maybe my employer can prove it's directly related to my work for them.
And most companies I worked for were very supportive of open source, one of them actively involved in several Apache projects and employing committers for several projects, on top of releasing their own software as open source.