A lot of stage and movie/TV musicals where the characters are actually singers have prominent diegetic elements - so Beautiful the Carol King musical, Jersey Boys, Elvis a Musical Revolution, The Commitments, Fame etc.
In the recent Star Trek: Strange New Worlds episode "Subspace Rhapsody" all the characters were aware that they were breaking into song, much like they were in "Once More With Feeling". Which isn't surprising as OMWF was a very clear influence on the Star Trek musical.