Elias omega coding: encoding
Husk, 16 13 11 bytes
ṁḋ↔Θ↑←¡ȯ←Lḋ

Try it online!
Outputs a flat boolean array.
-2 using the idea from Jonathan Allan's answer.
Explanation
ṁḋ↔Θ↑←¡ȯ←Lḋ
      ¡ȯ    create an infinite list using:
         Lḋ length of binary digits
        ←   decremented  
    ↑       take the longest prefix with:
     ←       elements that aren't falsy when decremented(1)
   Θ        prepend 0 to that
  ↔         reverse
ṁḋ          convert each to binary and flatten