I figure if I spent two days finding this, others may benefit:
To make the USART in an ATTINY (for example ATTINY404) work, the demo code is missing setting the pin direction for the TxD pin to PORT_DIR_OUT.
In other words, you have to add this first line:
PORTB_set_pin_dir(2, PORT_DIR_OUT);
USART_0_enable();
I finally found this in the ATTINY404 datasheet, page 290, section:
23.3.2.3 Data Transmission - USART Transmitter
When the transmitter has been enabled, the normal port operation of the TxD pin is overridden by the
USART and given the function as the transmitter's serial output. The direction of the pin n must be
configured as output by writing the Direction register for the corresponding port (PORTx.DIR[n]).