Edit: sorry, page refreshed and I put this on the wrong comment
Don't know if you’ve found it yet, but I encountered this bug also and it seemed to be when going to the level select menu after solving the level, and not continuing to the next level, but I couldn't test it fully as I already had 3 stars.
The level doesn't need to be redone though, you just go back to the main menu then then back to level select and it shows your stars.