Yes, German blue rams need caves. They need to have plenty of hiding spots in the tank as its in their nature to hide whenever they feel threatened.
Small rock caves and coconut caves are some of the best hiding spots you can provide for German blue rams. With that said, other types of structures, such as driftwood and miniature bridges, work just as fine.
Additionally, keeping the tank heavily planted is also recommended. In the wild, German blue rams typically live in densely planted waters. The best plants for a German blue ram tank include Java ferns, anubias, and Amazon swords.