Lemma 10.32 of Lee's Introduction to Smooth Manifolds I am reading over the proof of Lemma 10.32 (Local Frame Criterion for Subbundles) in Lee's Introduction to Smooth Manifolds.
The lemma says

Let $\pi: E \rightarrow M$ be a smooth vector bundle and suppose that for each $p\in M$ we are given an M-dimensional linear subspace $D_p \subseteq E_p$. Then $D = \cup_{p \in M} D_p \subseteq E$ is a smooth subbundle of $E$ iff each point of $M$ has a neighborhood $U$ on which there exist smooth local sections $\sigma_1, \cdots, \sigma_m: U \rightarrow E$ with the property that $\sigma_1(q), \cdots, \sigma_m(q)$ form a basis for $D_q$ at each $q \in U$.

Overall I understand the proof of this lemma, besides the part where we need to show that $D$ is an embedded submanifold with or without boundary of $E$. Professor Lee's proof says that

it suffices to show that each $p \in M$ has a neighborhood $U$ such that $D \cap \pi^{-1}(U)$ is an embedded submanifold (possibly with boundary) in $\pi^{-1}(U) \in E$.

It is not very obvious to me why it is sufficient by showing this. May someone explain the logic to me?
Edit: Here's my attempt to reason it: By Theorem 5.8, if $D ∩ \pi^{-1}(U)$ is an embedded submanifold in $\pi^{-1}(U)$, it satisfies the local k-slice condition. Now because $D$ is a union of $D ∩ \pi^{-1}(U)$ over different neighborhoods of $p \in M$, it satisfies the local k-slice condition as well, and hence again by Theorem 5.8, $D$ is an embedded submanifold.
Please let me know if anything is wrong and how it can be corrected.
Thank you very much.
Here's a screenshot of the Lemma and its (partial) proof:

 A: Suppose that there is an open cover $\{U_i\}$ of $E$ such that $D\cap U_i\hookrightarrow E$ is a smooth embedding and $D\cap U_i$ is open in $D$. I claim that $D\hookrightarrow E$ must be a smooth embedding.
Because $D\cap U_i$ is open in $D$, it follows that $D\hookrightarrow E$ is locally an immersion, so it must be an immersion globally. It is left to show that  the inclusion is also a topological embedding.
It suffices to show that  there is an open cover $\{V_i\}$ on $D$ which also forms an open cover on $D\subseteq E$ (subspace topology) on which the inclusion is a topological embedding. We were given that the inclusion is a topological embedding on sets of the open cover $\{D\cap U_i\}$. Since each $U_i$ is open in $E$, each $D\cap U_i$ is open in $D$ with the subspace topology induced by $E$.
A: Unfortunately, Theorem 5.8 only works for smooth manifolds without boundary. But here $E$ probably has boundary. A better theorem is Theorem 5.51，but it also requires that $M$ is a smooth manifold without boundary there.
