Systems that have a configuration variable for the base URL usually have it to gracefully handle situations like being behind a reverse proxy/balancer, etc. Otherwise, using the data that comes with the HTTP request should be enough for building URLs on the response.
If you look at the code for DSpaceRepositoryConfiguration.java, you will notice the code tests for a configured baseUrl variable, and falls back to using the request header information. But it ommits actually reading the configuration, so it is always null. If you read at other functions they all read the configuration variable before checking its value.
A PR will be send to patch this.