I am not sure if you are committed to the later but for the former you can do that in Java by the finding the right company. I also think (but don't have anything to back it up other than anecdotes) that the job market for the former is much bigger than if you solely restrict yourself to embedded systems, not just in Java but also in Rust/Go where a lot of companies are making that type of software.
For embedded device playing around, you could do some fun projects with micro-controllers (eg Raspberry Pico or ESP32):
* Write tiny db library (think sqlite with a smaller set of features)
* Write a multitasking OS for the Pico (easier than writing an os for traditional machines as you don't really have to support peripherals, you could look at FreeRTOS api and try to implement something that looks like it)