This is only partially true.
You are talking about Arbeitnehmererfindungen and those only belong to the employer if they are created on company time or if they are related to the work (Diensterfindung) every other invention belongs to the inventor (freie Erfindung) see §18 arbnerfg (3) althought you have to submit the invention to your employer if it could be related to the work (1-2)
https://www.gesetze-im-internet.de/arbnerfg/BJNR007560957.ht...